/* ============================================================
   STUDIO UABI — main.css
   Design system, base resets, header, footer, theme + lang toggle
   ============================================================ */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
  font-family: 'Open Sauce Sans';
  src: url('../assets/fonts/OpenSauceSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sauce Sans';
  src: url('../assets/fonts/OpenSauceSans-Black.ttf') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ---------- */
/* Light mode is the default */
:root,
[data-theme="light"] {
  --sand: #ffeed5;
  --uabi-red: #8c2333;
  --red-paper: #602c34;       /* deep red — for BACKGROUNDS ONLY, not text */
  --blue-paper: #94b4c1;      /* subtle blue */
  --blue-accent: #b4dbdc;     /* light blue (used in grid lines + title highlights) */
  --uabi-black: #252525;

  /* Semantic text tokens (used by every page) */
  --text-main:    var(--uabi-black);   /* body + most titles */
  --text-subtle:  #94b4c1;             /* low-emphasis text */
  --text-accent:  var(--uabi-red);     /* red highlight on titles + links */
  --text-highlight: #b4dbdc;           /* secondary title color */

  /* Grid lines in light mode: Blue Accent at low opacity */
  --grid-line: rgba(180, 219, 220, 0.55);
}

[data-theme="dark"] {
  --sand: #602c34;            /* Background is now Red Paper */
  --uabi-red: #b4dbdc;        /* Accent is now Blue Accent */
  --red-paper: #8c2333;       /* now Uabi Red — backgrounds only */
  --blue-paper: rgba(140, 35, 51, 0.2);
  --blue-accent: #94b4c1;
  --uabi-black: #ffeed5;      /* text is now Sand */

  /* Semantic text tokens in dark mode */
  --text-main:    #ffeed5;
  --text-subtle:  #94b4c1;             /* same in both modes */
  --text-accent:  #b4dbdc;             /* highlights via Blue Accent */
  --text-highlight: #b4dbdc;

  /* Grid lines in dark mode: Uabi Red ONLY, at low opacity */
  --grid-line: rgba(140, 35, 51, 0.20);
}

/* ---------- Base reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Open Sauce Sans', 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
  color: var(--uabi-black);
  background-color: var(--sand);
  /* The grid is drawn purely with two crossing gradient lines */
  background-image:
    linear-gradient(to right, var(--grid-line) 0.5px, transparent 0.5px),
    linear-gradient(to bottom, var(--grid-line) 0.5px, transparent 0.5px);
  /* 38px squares, thinner 0.5px lines for a more delicate grid */
  background-size: 38px 38px;
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
}
input { font: inherit; color: inherit; }

/* ---------- Custom cursor (degrades to default if files missing) ---------- */
html, body {
  cursor: url('../assets/cursor_POINTER_1.png') 6 2, default;
}
a, button, [data-hover], label[for], input[type="submit"],
a *, button * {
  cursor: url('../assets/cursor_POINTER_2.png') 6 2, pointer !important;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 56px;
  background: transparent;
  pointer-events: none; /* let body show through; children re-enable */
}
.site-header > * { pointer-events: auto; }

/* Once the page scrolls, give the header a solid backdrop so the
   logo + menu never sit illegibly on top of moving content. It
   returns to transparent at the very top. */
.site-header {
  transition: background-color 0.3s ease, box-shadow 0.3s ease, padding 0.3s ease;
}
.site-header.is-scrolled {
  background: var(--sand);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .site-header.is-scrolled {
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.site-wordmark {
  font-size: 26px;          /* 200% of the original 13px */
  font-weight: 900;
  letter-spacing: 0.02em;
  color: var(--uabi-red);
  text-transform: uppercase;
  line-height: 1;
}
.site-logo-mobile {
  display: none;
  width: 38px;
  height: auto;
}
.site-logo-mobile svg path { fill: var(--uabi-red); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 80px;
}
.site-nav a {
  font-size: 16px;          /* ~150% of the original 11px */
  font-weight: 900;
  letter-spacing: 0.12em;   /* slightly tightened for the larger size */
  text-transform: uppercase;
  color: var(--uabi-red);
  transition: opacity 0.2s ease;
}
.site-nav a:hover { opacity: 0.65; }
.site-nav a.is-active { text-decoration: underline; text-underline-offset: 4px; }

/* Theme toggle button (sun/moon swap) */
.theme-toggle {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--uabi-red);
  transition: opacity 0.2s ease;
}
.theme-toggle:hover { opacity: 0.65; }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 18px;
  height: 18px;
  display: none;
}
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"]  .theme-toggle .icon-moon { display: block; }
/* Default (no [data-theme] yet) shows sun */
html:not([data-theme="dark"]) .theme-toggle .icon-sun { display: block; }

/* Hamburger button (mobile only) */
.menu-toggle {
  display: none;
  width: 28px;
  height: 22px;
  position: relative;
}
.menu-toggle span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--uabi-red);
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.menu-toggle span:nth-child(1) { top: 4px; }
.menu-toggle span:nth-child(2) { top: 10px; }
.menu-toggle span:nth-child(3) { top: 16px; }
.menu-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.is-open span:nth-child(2) { opacity: 0; }
.menu-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Full-screen mobile menu overlay */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: var(--sand);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.menu-overlay a {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--uabi-red);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.menu-overlay.is-open a { opacity: 1; transform: translateY(0); }
.menu-overlay.is-open a:nth-child(1) { transition-delay: 0.08s; }
.menu-overlay.is-open a:nth-child(2) { transition-delay: 0.16s; }
.menu-overlay.is-open a:nth-child(3) { transition-delay: 0.24s; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 40px 56px;
  margin-top: auto;
}
.site-footer .copyright {
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  opacity: 0.85;
}
.lang-toggle {
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lang-toggle a, .lang-toggle span { color: var(--text-subtle); opacity: 0.7; }
.lang-toggle .is-active { color: var(--uabi-red); opacity: 1; font-weight: 700; }

/* Lang toggle injected into the header nav (desktop) — cluster it
   next to the theme toggle rather than a full 80px nav gap away. */
.site-nav .lang-toggle { margin-left: -56px; }
.site-nav .lang-toggle a:hover { opacity: 1; }

/* Lang toggle injected into the mobile menu overlay */
.menu-overlay .lang-toggle {
  margin-top: 14px;
  font-size: 16px;
  letter-spacing: 0.18em;
}
.menu-overlay .lang-toggle a,
.menu-overlay .lang-toggle span { font-size: 16px; }

/* Theme switch injected into the mobile menu (LIGHT · DARK) */
.menu-overlay .theme-switch {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 16px;
  letter-spacing: 0.18em;
}
.menu-overlay .theme-switch button {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  color: var(--text-subtle);
  opacity: 0.7;
  cursor: pointer;
}
.menu-overlay .theme-switch button.is-active {
  color: var(--uabi-red);
  opacity: 1;
  font-weight: 700;
}

/* Footer can be centered on welcome */
.site-footer.is-centered {
  justify-content: center;
  gap: 24px;
}

/* ============================================================
   Reusable PILL components (buttons + inputs)
   Used on Welcome, Contact, Studio CTA, etc.
   ============================================================ */

/* ---------- Pill button ---------- */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--uabi-red);
  color: var(--sand);
  border: 1.5px solid var(--uabi-red);
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
}
.btn-pill:hover { transform: translateX(2px); opacity: 0.92; }
[data-theme="dark"] .btn-pill {
  background: #b4dbdc;
  border-color: #b4dbdc;
  color: var(--sand);
}

/* Outline variant: transparent fill, colored border + text */
.btn-pill.is-outline {
  background: transparent;
  color: var(--uabi-red);
}
[data-theme="dark"] .btn-pill.is-outline {
  background: transparent;
  color: #b4dbdc;
  border-color: #b4dbdc;
}
.btn-pill.is-outline:hover {
  background: var(--uabi-red);
  color: var(--sand);
}
[data-theme="dark"] .btn-pill.is-outline:hover {
  background: #b4dbdc;
  color: var(--sand);
}

/* Larger variant for primary CTAs */
.btn-pill.is-large {
  padding: 17px 36px;
  font-size: 14px;
  letter-spacing: 0.16em;
}

/* ---------- Pill input ---------- */
.pill-input {
  background: transparent;
  border: 1.5px solid var(--text-subtle);
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.pill-input::placeholder { color: var(--text-subtle); opacity: 0.7; }
.pill-input:focus { border-color: var(--uabi-red); }
[data-theme="dark"] .pill-input:focus { border-color: #b4dbdc; }

/* Textarea-shaped: softer corners, more padding */
.pill-input.is-area {
  border-radius: 22px;
  padding: 16px 22px;
  line-height: 1.6;
  resize: none;
}

/* ============================================================
   View Transitions (smooth page-to-page)
   ============================================================ */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(.2,.7,.2,1);
}

/* ---------- Loader overlay (used between pages) ---------- */
.uabi-loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sand);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.uabi-loader.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.uabi-loader .quote {
  font-size: 18px;
  line-height: 1.5;
  font-style: italic;
  color: var(--text-subtle);
  max-width: 520px;
  text-align: center;
  padding: 0 24px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.uabi-loader.is-visible .quote { opacity: 1; transform: translateY(0); }

/* ============================================================
   Accessibility: reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Responsive — mobile breakpoint at 768px
   ============================================================ */
@media (max-width: 768px) {
  /* A fixed background image forces the browser to repaint the whole
     grid on every scroll frame — on phones (esp. iOS) this makes
     scrolling stutter so badly it feels like the page won't scroll.
     Let the grid scroll with the content instead. */
  body {
    background-attachment: scroll;
  }

  .site-header { padding: 18px 22px; }
  .site-wordmark { display: none; }
  .site-logo-mobile { display: inline-block; }

  .site-nav { display: none; }            /* hidden on mobile */
  .menu-toggle { display: inline-block; } /* hamburger appears */

  .site-footer { padding: 24px 22px; }
}
