/* =========================================================================
   Hiro Miyoshi Consulting
   Token-driven. Two themes (dark = primary, light = ivory print identity).
   ========================================================================= */

:root {
  --gold-brand: #B8975A;

  /* Semantic tokens — DARK (default) */
  --bg:          #0A0A0A;
  --bg-raise:    #111010;
  --line:        #211f1c;
  --text:        #F3ECDF;
  --text-dim:    #C7BEAE;
  --text-mute:   #8C8477;
  --accent:      #B8975A;
  --accent-ink:  #CBAE77;
  --accent-line: rgba(184, 151, 90, 0.32);
  --header-bg:   rgba(10, 10, 10, 0.72);
  --img-filter:  saturate(0.82) brightness(0.92);
  --sel-bg:      #B8975A;
  --sel-fg:      #0A0A0A;

  /* Type */
  --font-head:  "Forum", "Cormorant Garamond", "Times New Roman", serif;
  --font-body:  "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --font-label: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;

  --fs-hero:   clamp(2.7rem, 6.6vw, 6rem);
  --fs-h2:     clamp(2rem, 3.8vw, 3.2rem);
  --fs-h3:     clamp(1.3rem, 1.9vw, 1.55rem);
  --fs-lede:   clamp(1.2rem, 2vw, 1.5rem);
  --fs-body:   clamp(1.1rem, 1.4vw, 1.28rem);
  --fs-label:  0.74rem;

  --lh-tight:  1.08;
  --lh-body:   1.6;
  --track-label: 0.24em;

  /* Space */
  --wrap-max:  1200px;
  --gutter:    clamp(1.4rem, 5vw, 4.5rem);
  --section-y: clamp(5rem, 12vw, 11rem);

  /* Motion */
  --ease:      cubic-bezier(0.22, 1, 0.36, 1);
  --dur:       0.6s;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:          #F1E9D8;
  --bg-raise:    #E9DFC9;
  --line:        #D9CDB2;
  --text:        #1B1611;
  --text-dim:    #4C4636;
  --text-mute:   #6E6450;
  --accent:      #B8975A;
  --accent-ink:  #7A5A1E;
  --accent-line: rgba(122, 90, 30, 0.30);
  --header-bg:   rgba(241, 233, 216, 0.80);
  --img-filter:  saturate(0.94) brightness(0.99) contrast(1.02);
  --sel-bg:      #B8975A;
  --sel-fg:      #1B1611;
  color-scheme: light;
}

/* =========================================================================
   Base
   ========================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; line-height: var(--lh-tight); margin: 0; letter-spacing: 0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--sel-bg); color: var(--sel-fg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { width: 100%; max-width: var(--wrap-max); margin-inline: auto; padding-inline: var(--gutter); }
section[id] { scroll-margin-top: 5rem; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--sel-fg);
  padding: 0.6rem 1rem; font-family: var(--font-label); letter-spacing: 0.08em;
}
.skip-link:focus { left: 0; }

/* Shared labels / headings */
.eyebrow, .section-kicker {
  font-family: var(--font-label);
  font-size: var(--fs-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--accent-ink);
  font-weight: 500;
  margin: 0 0 1.4rem;
}
.section-heading { font-size: var(--fs-h2); color: var(--text); max-width: 22ch; }

/* =========================================================================
   Reveal-on-scroll
   ========================================================================= */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.9s var(--ease), transform 1s var(--ease);
  will-change: opacity, transform;
}
.js [data-reveal].is-visible { opacity: 1; transform: none; }
/* stagger service cards */
.js .services li[data-reveal] { transition-delay: calc(var(--i, 0) * 80ms); }
.js .services li:nth-child(1) { --i: 0; }
.js .services li:nth-child(2) { --i: 1; }
.js .services li:nth-child(3) { --i: 2; }
.js .services li:nth-child(4) { --i: 0; }
.js .services li:nth-child(5) { --i: 1; }
.js .services li:nth-child(6) { --i: 2; }

/* =========================================================================
   Header — transparent over hero, solid on scroll
   ========================================================================= */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.45s var(--ease), border-color 0.45s var(--ease), backdrop-filter 0.45s var(--ease);
}
.site-header.scrolled {
  background: var(--header-bg);
  border-bottom-color: var(--line);
  backdrop-filter: saturate(120%) blur(12px);
  -webkit-backdrop-filter: saturate(120%) blur(12px);
}
/* Legibility scrim behind the transparent header over the hero */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(10, 10, 10, 0.6), rgba(10, 10, 10, 0));
  transition: opacity 0.45s var(--ease);
  pointer-events: none;
}
.site-header.scrolled::before { opacity: 0; }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; min-height: 4.9rem;
}

/* Over the hero, force light chrome; when scrolled, follow the theme */
.brandmark { display: inline-flex; align-items: center; gap: 0.85rem; }
.brandmark-mark { display: flex; color: var(--gold-brand); }
.brandmark-mark svg { height: 38px; width: 38px; display: block; }
.brandmark-text { display: flex; flex-direction: column; gap: 0.3rem; }
.brandmark-name {
  font-family: var(--font-head); font-size: 1.18rem; letter-spacing: 0.14em;
  text-transform: uppercase; line-height: 1; color: #F4ECDE;
  white-space: nowrap;
  transition: color 0.45s var(--ease);
}
.brandmark-desc {
  font-family: var(--font-label); font-size: 0.6rem; letter-spacing: 0.4em;
  text-transform: uppercase; color: var(--gold-brand); font-weight: 500;
  transition: color 0.45s var(--ease);
}
.site-header.scrolled .brandmark-name { color: var(--text); }
.site-header.scrolled .brandmark-desc { color: var(--accent-ink); }

.nav-cluster { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.2rem); }
.site-nav {
  display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.2rem);
  font-family: var(--font-label); font-size: 0.8rem; letter-spacing: 0.13em;
  text-transform: uppercase; font-weight: 500;
}
.site-nav a { color: rgba(244, 236, 222, 0.82); padding-block: 0.4rem; white-space: nowrap; transition: color var(--dur) var(--ease); }
.site-nav a:hover { color: #fff; }
.nav-enquire { color: var(--gold-brand) !important; border-bottom: 1px solid var(--accent-line); }
.site-header.scrolled .site-nav a { color: var(--text-dim); }
.site-header.scrolled .site-nav a:hover { color: var(--text); }
.site-header.scrolled .nav-enquire { color: var(--accent-ink) !important; }

.theme-toggle {
  appearance: none; background: none; border: none; padding: 0.4rem; margin: 0;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: inherit;
}
.toggle-orb {
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--gold-brand);
  background: linear-gradient(90deg, #F4ECDE 0 50%, transparent 50% 100%);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.site-header.scrolled .toggle-orb { background: linear-gradient(90deg, var(--text) 0 50%, transparent 50% 100%); }
:root[data-theme="light"] .toggle-orb { transform: rotate(180deg); }

@media (max-width: 680px) {
  .site-nav a:not(.nav-enquire) { display: none; }
  .brandmark { gap: 0.6rem; }
  .brandmark-mark svg { height: 32px; width: 32px; }
  .brandmark-name { font-size: 1.02rem; letter-spacing: 0.1em; }
  .brandmark-desc { font-size: 0.55rem; letter-spacing: 0.32em; }
}

/* =========================================================================
   Hero — immersive full-bleed image
   ========================================================================= */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: #0A0A0A;
}
.hero-media { position: absolute; inset: -6% 0 -6% 0; z-index: 0; will-change: transform; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 60% 35%; }
.hero-veil {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, rgba(10,10,10,0.94) 0%, rgba(10,10,10,0.55) 34%, rgba(10,10,10,0.12) 62%, rgba(10,10,10,0.35) 100%),
    linear-gradient(to right, rgba(10,10,10,0.72) 0%, rgba(10,10,10,0.28) 52%, rgba(10,10,10,0.08) 100%);
}
.hero-content { position: relative; z-index: 1; padding-bottom: clamp(4.5rem, 11vh, 9rem); padding-top: 7rem; }
.hero-eyebrow { color: var(--gold-brand); }
.hero-thesis { font-size: var(--fs-hero); color: #F6EFE3; max-width: 17ch; }
.hero-lede { font-size: var(--fs-lede); color: rgba(233,224,208,0.9); max-width: 46ch; margin-top: clamp(1.6rem, 3vw, 2.2rem); font-style: italic; }

.cta {
  display: inline-block; margin-top: clamp(2rem, 4vw, 2.8rem);
  font-family: var(--font-label); font-size: 0.82rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text);
  padding: 0.95rem 2rem; border: 1px solid var(--accent-line);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.cta:hover { background: var(--accent); border-color: var(--accent); color: var(--sel-fg); }
.cta-light { color: #F6EFE3; border-color: rgba(244,236,222,0.4); }
.cta-light:hover { background: var(--gold-brand); border-color: var(--gold-brand); color: #0A0A0A; }

/* Hero scroll cue */
.hero-scroll {
  position: absolute; z-index: 1; bottom: 1.6rem; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 1px solid rgba(244,236,222,0.4); border-radius: 14px;
  display: flex; justify-content: center;
}
.hero-scroll span { width: 2px; height: 8px; margin-top: 7px; border-radius: 2px; background: var(--gold-brand); animation: scrollcue 1.9s var(--ease) infinite; }
@keyframes scrollcue { 0% { opacity: 0; transform: translateY(-3px); } 40% { opacity: 1; } 80% { opacity: 0; transform: translateY(10px); } 100% { opacity: 0; } }

/* Hero load-in */
.js .hero-content > * { opacity: 0; transform: translateY(22px); animation: heroIn 1s var(--ease) forwards; }
.js .hero-content > *:nth-child(1) { animation-delay: 0.25s; }
.js .hero-content > *:nth-child(2) { animation-delay: 0.38s; }
.js .hero-content > *:nth-child(3) { animation-delay: 0.52s; }
.js .hero-content > *:nth-child(4) { animation-delay: 0.66s; }
@keyframes heroIn { to { opacity: 1; transform: none; } }
.js .hero-media img { animation: heroZoom 2.4s var(--ease) both; }
@keyframes heroZoom { from { transform: scale(1.09); } to { transform: scale(1); } }

/* =========================================================================
   Sections
   ========================================================================= */
.section { padding-block: var(--section-y); border-top: 1px solid var(--line); }

/* What we do */
#work .section-heading { max-width: 26ch; margin-bottom: clamp(3rem, 6vw, 4.8rem); }
.services {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr);
  column-gap: clamp(2rem, 4vw, 3.6rem); row-gap: clamp(2.6rem, 5vw, 4rem);
  counter-reset: svc;
}
.services li { counter-increment: svc; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.services li::before {
  content: counter(svc, decimal-leading-zero);
  display: block; font-family: var(--font-label); font-size: 0.72rem;
  letter-spacing: 0.2em; color: var(--accent-ink); margin-bottom: 1.1rem; font-weight: 500;
}
.services h3 { font-size: var(--fs-h3); color: var(--text); margin-bottom: 0.7rem; }
.services p { color: var(--text-dim); font-size: 1.08rem; line-height: 1.5; max-width: 34ch; }
@media (max-width: 860px) { .services { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .services { grid-template-columns: 1fr; } }

/* Cinematic band */
.cinema {
  position: relative; min-height: clamp(24rem, 62vh, 40rem);
  display: flex; align-items: center; overflow: hidden; background: #0A0A0A;
}
.cinema-media { position: absolute; inset: -8% 0 -8% 0; z-index: 0; will-change: transform; }
.cinema-media img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.cinema-veil { position: absolute; inset: 0; background: linear-gradient(to right, rgba(10,10,10,0.85), rgba(10,10,10,0.5) 60%, rgba(10,10,10,0.3)); }
.cinema-content { position: relative; z-index: 1; }
.cinema-line { font-family: var(--font-head); font-size: clamp(1.9rem, 4.2vw, 3.6rem); color: #F6EFE3; max-width: 20ch; line-height: 1.12; }

/* Operators */
.section-operators { background: var(--bg-raise); }
.operators-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2.4rem, 6vw, 5rem); align-items: center; }
.operators-copy .section-heading { margin-bottom: 1.6rem; }
.operators-copy p { color: var(--text-dim); max-width: 46ch; }
.operators-copy p + p { margin-top: 1.1rem; }
.operators-coda {
  font-family: var(--font-head) !important; color: var(--accent-ink) !important;
  font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: 0.01em;
  margin-top: clamp(1.6rem, 3vw, 2.2rem) !important; padding-top: 1.4rem; border-top: 1px solid var(--accent-line);
}
.operators-media { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(0.8rem, 1.6vw, 1.1rem); }
.media { margin: 0; overflow: hidden; border: 1px solid var(--line); }
.media img { width: 100%; height: 100%; object-fit: cover; filter: var(--img-filter); transition: transform 1.2s var(--ease), filter 1.2s var(--ease); }
.media:hover img { transform: scale(1.04); filter: saturate(1) brightness(1); }
.media-tall { grid-column: 1 / -1; aspect-ratio: 16 / 10; }
.operators-media .media:not(.media-tall) { aspect-ratio: 4 / 3; }
@media (max-width: 780px) {
  .operators-grid { grid-template-columns: 1fr; }
  .operators-media { order: 2; }
}

/* Markets */
.markets-heading { max-width: 24ch; font-size: clamp(1.8rem, 3.6vw, 2.9rem); letter-spacing: 0.03em; }
.markets-lede { font-size: var(--fs-lede); color: var(--text-dim); max-width: 52ch; margin-top: 1.8rem; }
.markets-note { margin-top: 2.4rem; padding-top: 1.6rem; border-top: 1px solid var(--accent-line); color: var(--text-mute); font-style: italic; font-size: 1.12rem; max-width: 48ch; }

/* Enquire */
.section-enquire { text-align: center; padding-block: clamp(6rem, 14vw, 12rem); }
.enquire-heading { margin-inline: auto; max-width: 22ch; font-size: clamp(2.1rem, 4.6vw, 3.6rem); }
.enquire-lede { color: var(--text-dim); font-style: italic; font-size: var(--fs-lede); margin-top: 1.4rem; }
.email-link {
  display: inline-block; margin-top: clamp(2.2rem, 5vw, 3.2rem);
  font-family: var(--font-head); font-size: clamp(1.5rem, 3.6vw, 2.4rem); letter-spacing: 0.02em;
  color: var(--accent-ink); border-bottom: 1px solid var(--accent-line); padding-bottom: 0.25rem;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.email-link:hover { color: var(--accent); border-color: var(--accent); }
.enquire-place { margin-top: 1.8rem; color: var(--text-mute); font-size: 0.8rem; letter-spacing: 0.22em; text-transform: uppercase; font-family: var(--font-label); font-weight: 500; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(3rem, 6vw, 4.5rem) clamp(1.8rem, 4vw, 2.6rem);
}
.footer-main {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2.4rem 3rem;
}
.footer-wordmark { display: inline-flex; flex-direction: column; gap: 0.32rem; }
.footer-wordmark-name {
  font-family: var(--font-head); font-size: 1.15rem; letter-spacing: 0.14em;
  text-transform: uppercase; line-height: 1; color: var(--text);
}
.footer-wordmark-desc {
  font-family: var(--font-label); font-size: 0.58rem; letter-spacing: 0.4em;
  text-transform: uppercase; color: var(--accent-ink); font-weight: 500;
}
.footer-note { margin-top: 1.1rem; color: var(--text-mute); font-size: 1.02rem; max-width: 34ch; }

.footer-contact { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.footer-email {
  font-family: var(--font-head); font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  color: var(--accent-ink); border-bottom: 1px solid var(--accent-line); padding-bottom: 0.2rem;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.footer-email:hover { color: var(--accent); border-color: var(--accent); }
.footer-address { font-style: normal; color: var(--text-mute); font-size: 1.02rem; line-height: 1.55; }

.footer-fine {
  margin-top: clamp(2.6rem, 5vw, 3.8rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.footer-fine p {
  margin: 0;
  font-family: var(--font-label);
  font-size: 0.72rem;
  line-height: 1.6;
  letter-spacing: 0.015em;
  color: var(--text-mute);
  max-width: 96ch;
}

/* =========================================================================
   Theme transition (View Transitions API)
   ========================================================================= */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 0; }
::view-transition-new(root) { z-index: 1; }

/* =========================================================================
   Reduced motion
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js [data-reveal] { opacity: 1 !important; transform: none !important; }
  .hero-media, .cinema-media { transform: none !important; }
  ::view-transition-group(*), ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
