/* ============================================
   MAIN.CSS — Global Layout, Nav, Footer, Typography
   ============================================ */

/* Base */
body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-primary);
  line-height: 1.2;
}

.display {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  line-height: 0.95;
}

.display-serif {
  font-family: var(--font-serif);
  line-height: 1.05;
  font-weight: 400;
}

.script {
  font-family: var(--font-script);
  font-weight: 400;
  line-height: 1.2;
}

p {
  color: var(--text-secondary);
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-24) 0;
}

/* ============================================
   NAV
   ============================================ */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  transition: background-color var(--transition), box-shadow var(--transition);
}

.nav.scrolled {
  background-color: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.nav__logo {
  display: flex;
  align-items: center;
}

.nav__logo img {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.theme-toggle {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.nav__link {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color var(--transition);
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav__link:hover,
.nav__link.active {
  color: var(--text-primary);
}

.nav__link:hover::after,
.nav__link.active::after {
  width: 100%;
}

.nav__link--cta {
  background: var(--accent);
  color: var(--white) !important;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  letter-spacing: 0.06em;
}

.nav__link--cta::after {
  display: none;
}

.nav__link--cta:hover {
  background: var(--accent-hover) !important;
}

/* Hamburger */
.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: var(--space-2);
  cursor: pointer;
  z-index: 1001;
}

.nav__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--transition), opacity var(--transition);
  transform-origin: center;
}

.nav__hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav__hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-16) 0 var(--space-8);
}

.footer__inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-12);
  padding-bottom: var(--space-12);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-8);
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer__logo {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-2);
}

.footer__logo img {
  height: 34px;
  width: auto;
  object-fit: contain;
}

.footer__tagline {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.6;
}

.footer__heading {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__links a {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  transition: color var(--transition);
}

.footer__links a:hover {
  color: var(--accent-hover);
}

.footer__social {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.footer__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.footer__social svg {
  width: 18px;
  height: 18px;
}

.footer__social a:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
  background: var(--accent-dim);
}

.footer__wordmark {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 9vw, 9rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: var(--space-12) 0 0;
  white-space: nowrap;
  overflow: hidden;
}

.footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-8);
}

/* ============================================
   RESPONSIVE — MOBILE NAV
   ============================================ */

@media (max-width: 768px) {
  .nav__hamburger {
    display: flex;
  }

  .nav__menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--surface);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-12) var(--space-8);
    gap: var(--space-8);
    transition: right var(--transition-slow);
    z-index: 1000;
  }

  .nav__menu.open {
    right: 0;
  }

  .nav__link {
    font-size: 1.1rem;
  }

  .footer__inner {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .footer__bottom {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }

  .container {
    padding: 0 var(--space-4);
  }
}
