/* ===================================================================
   HK TOOLS ARCHVIZ - design system
   -------------------------------------------------------------------
   Token values are derived from measurements of the reference study
   (see docs/DESIGN-SPEC.md). The visual language here is our own:
   our palette, copy, grid rhythm and imagery.

   Type rule observed and adopted:
     display type is FLUID (vw-based), set in a single 400 weight,
     UPPERCASE, tracked -0.03em, with leading TIGHTER than the type
     size (0.88 desktop / 0.94 mobile). Body is 300 weight at 1.5.
   =================================================================== */

/* ---------------------------------------------------- design tokens */
:root {
  /* palette - warm neutral, so the renders carry all the colour */
  --ink:        #1b1b1b;
  --ink-2:      #6e6e6e;
  --ink-3:      #a6a6a6;
  --paper:      #f2f1ee;
  --paper-2:    #e8e6e1;
  --sand:       #c9bfb0;
  --line:       #d8d5cf;
  --black:      #0e0e0e;
  --white:      #ffffff;

  /* fluid display scale */
  --t-display:  clamp(2.6rem, 7.2vw, 7.6rem);
  --t-h2:       clamp(2.1rem, 5.6vw, 5.4rem);
  --t-h3:       clamp(1.5rem, 3.4vw, 3.1rem);
  --t-h4:       clamp(1.05rem, 1.9vw, 1.55rem);
  --t-body:     clamp(0.95rem, 1.05vw, 1.05rem);
  --t-lede:     clamp(1.05rem, 1.5vw, 1.35rem);
  --t-meta:     0.75rem;

  /* leading + tracking */
  --lh-display: 0.88;
  --ls-display: -0.03em;
  --ls-meta:    0.08em;

  /* rhythm */
  --gutter:     clamp(1.25rem, 4vw, 4.5rem);
  --section:    clamp(5rem, 12vw, 11rem);
  --rule:       1px solid var(--line);

  /* motion - curves measured from the reference's own transitions */
  --ease-out:   cubic-bezier(0.075, 0.82, 0.165, 1);
  --ease-inout: cubic-bezier(0.645, 0.045, 0.355, 1);
  --ease-soft:  cubic-bezier(0.25, 1, 0.5, 1);
  --d-reveal:   1.05s;
  --d-wipe:     0.9s;
}

/* ------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Inter, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: var(--t-body);
  font-weight: 300;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 400; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* keyboard focus must always stay visible - do not remove */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--ink); color: var(--paper); padding: 0.85rem 1.25rem;
  font-size: var(--t-meta); letter-spacing: var(--ls-meta); text-transform: uppercase;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------- typography */
.display {
  font-size: var(--t-display);
  line-height: var(--lh-display);
  letter-spacing: var(--ls-display);
  text-transform: uppercase;
  font-weight: 400;
}
.h2 { font-size: var(--t-h2);  line-height: 0.92; letter-spacing: var(--ls-display); text-transform: uppercase; }
.h3 { font-size: var(--t-h3);  line-height: 1.0;  letter-spacing: -0.02em;           text-transform: uppercase; }
.h4 { font-size: var(--t-h4);  line-height: 1.1;  letter-spacing: -0.015em;          text-transform: uppercase; }
.lede { font-size: var(--t-lede); line-height: 1.45; font-weight: 300; max-width: 46ch; }
.meta {
  font-size: var(--t-meta); letter-spacing: var(--ls-meta);
  text-transform: uppercase; color: var(--ink-2); font-weight: 400;
}
.muted { color: var(--ink-2); }

@media (max-width: 760px) { :root { --lh-display: 0.94; } }

/* ----------------------------------------------------------- layout */
.wrap { width: 100%; padding-inline: var(--gutter); margin-inline: auto; max-width: 1800px; }
.section { padding-block: var(--section); }
.band-dark { background: var(--black); color: var(--paper); }
.band-dark .meta { color: #9a9a9a; }
.band-dark .muted { color: #9a9a9a; }
.band-alt  { background: var(--paper-2); }

.row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: clamp(1.5rem, 3vw, 3rem);
  border-bottom: var(--rule);
  margin-bottom: clamp(2rem, 4vw, 4rem);
}
.band-dark .row-head { border-color: #2a2a2a; }

/* ----------------------------------------------------------- header */
.site-head {
  position: fixed; inset: 0 0 auto 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 1.8vw, 1.6rem) var(--gutter);
  mix-blend-mode: difference; color: #fff;
  transition: transform 0.5s var(--ease-out);
}
.site-head.hide { transform: translateY(-110%); }
.brand { font-size: 0.95rem; letter-spacing: -0.02em; text-transform: uppercase; white-space: nowrap; }
.brand sup { font-size: 0.5em; vertical-align: super; }
.nav { display: flex; gap: clamp(1rem, 2vw, 2.25rem); }
.nav a {
  font-size: var(--t-meta); letter-spacing: var(--ls-meta); text-transform: uppercase;
  position: relative; padding-block: 0.25rem;
}
.nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

.nav-toggle { display: none; font-size: var(--t-meta); letter-spacing: var(--ls-meta); text-transform: uppercase; }

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .nav {
    position: fixed; inset: 0; background: var(--black); color: var(--paper);
    flex-direction: column; justify-content: center; align-items: flex-start;
    gap: 0.5rem; padding: var(--gutter);
    clip-path: inset(0 0 100% 0); transition: clip-path 0.7s var(--ease-inout);
    mix-blend-mode: normal;
  }
  .nav[data-open="true"] { clip-path: inset(0 0 0 0); }
  .nav a { font-size: clamp(2rem, 9vw, 3.2rem); letter-spacing: var(--ls-display); line-height: 1.05; }
  .site-head[data-open="true"] { mix-blend-mode: normal; color: var(--paper); }
}

/* ------------------------------------------------------------- hero */
.hero { padding-top: clamp(7rem, 16vh, 11rem); padding-bottom: clamp(2rem, 5vw, 4rem); }
.hero-title { max-width: 18ch; }
.hero-sub {
  display: flex; gap: clamp(1.5rem, 4vw, 4rem); flex-wrap: wrap;
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

/* -------------------------------------------------------------- work */
.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: clamp(2rem, 4vw, 4.5rem) clamp(1.5rem, 2.5vw, 3rem);
  align-items: start;
}
/* Cards sit level. Equal heights so a two-line title cannot push its
   neighbour down, and the image is the part that stays a fixed shape. */
.work-grid > * { align-self: start; }

.card { display: block; }
.card-media {
  position: relative; overflow: hidden; background: var(--paper-2);
  aspect-ratio: 4 / 3;
}
.card-media.tall { aspect-ratio: 3 / 4; }
.card-media img, .card-media video {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.001);
  transition: transform 1.4s var(--ease-out);
  will-change: transform;
}
.card:hover .card-media img, .card:hover .card-media video { transform: scale(1.055); }
.card-body { padding-top: clamp(0.9rem, 1.4vw, 1.3rem); }
.card-cats { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.card-cats span + span::before { content: "- "; color: var(--ink-3); }
.card-title { margin-top: 0.4rem; }

/* placeholder shown until a real render is dropped into R2 */
.ph {
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, rgba(0,0,0,0.035) 14px 15px),
    linear-gradient(160deg, var(--paper-2), var(--sand));
  display: grid; place-items: center;
}
.ph span { font-size: var(--t-meta); letter-spacing: var(--ls-meta); text-transform: uppercase; color: var(--ink-2); }

/* -------------------------------------------------------------- reel */
.reel-frame {
  position: relative; overflow: hidden; background: var(--black);
  aspect-ratio: 16 / 9;
}
.reel-frame video, .reel-frame img { width: 100%; height: 100%; object-fit: cover; }
.reel-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; letter-spacing: var(--ls-meta); text-transform: uppercase; font-size: var(--t-meta);
}
.reel-play .dot {
  display: grid; place-items: center;
  width: clamp(5rem, 9vw, 8rem); aspect-ratio: 1; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.65);
  background: rgba(0,0,0,0.12);
  transition: transform 0.6s var(--ease-out), background 0.4s linear;
}
.reel-play:hover .dot { transform: scale(1.08); background: rgba(0,0,0,0.3); }

/* ---------------------------------------------------------- services */
.svc { border-top: var(--rule); }
.svc-item {
  display: grid; gap: 0.75rem 2rem;
  grid-template-columns: 4rem 1fr;
  padding-block: clamp(1.5rem, 2.6vw, 2.4rem);
  border-bottom: var(--rule);
  align-items: start;
}
@media (min-width: 900px) {
  .svc-item { grid-template-columns: 5rem minmax(0, 22ch) 1fr; align-items: baseline; }
}
.svc-no { color: var(--ink-3); font-size: var(--t-meta); letter-spacing: var(--ls-meta); }
.svc-desc { color: var(--ink-2); max-width: 52ch; }

/* ----------------------------------------------------------- marquee */
.marquee { overflow: hidden; border-block: var(--rule); padding-block: clamp(1rem, 1.8vw, 1.6rem); }
.marquee-track { display: flex; gap: clamp(2rem, 5vw, 5rem); width: max-content; will-change: transform; }
.marquee-track > span {
  font-size: var(--t-h3); text-transform: uppercase; letter-spacing: var(--ls-display);
  color: var(--ink-3); white-space: nowrap;
}

/* ----------------------------------------------------------- contact */
/* Sized smaller than a display heading on purpose: a 34-character email
   address at --t-h2 overflows its panel on every width below ~1600px.
   overflow-wrap lets a long address break rather than escape the band. */
.contact-link {
  display: inline-block;
  font-size: clamp(1.15rem, 3.1vw, 2.55rem);
  line-height: 1.1; letter-spacing: -0.02em;
  text-transform: uppercase; position: relative; padding-bottom: 0.1em;
  max-width: 100%; overflow-wrap: anywhere;
}
.contact-link::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: currentColor; transform: scaleX(0); transform-origin: right;
  transition: transform 0.6s var(--ease-out);
}
.contact-link:hover::after { transform: scaleX(1); transform-origin: left; }

.site-foot { border-top: var(--rule); padding-block: clamp(2rem, 3vw, 3rem); }
.foot-row { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }

/* ------------------------------------------------- scroll reveals ---
   Elements start hidden and animate in once, when scrolled into view.
   The no-js and reduced-motion paths make sure content is never
   trapped invisible.                                                  */
[data-reveal] { opacity: 0; transform: translateY(2.2rem); }
[data-reveal].in {
  opacity: 1; transform: none;
  transition: opacity 0.9s var(--ease-soft), transform var(--d-reveal) var(--ease-out);
  transition-delay: var(--delay, 0ms);
}
[data-wipe] > * { clip-path: inset(0 0 100% 0); }
[data-wipe].in > * {
  clip-path: inset(0 0 0 0);
  transition: clip-path var(--d-wipe) var(--ease-inout);
  transition-delay: var(--delay, 0ms);
}
/* split-line headline reveal */
.line-mask { display: block; overflow: hidden; }
.line-mask > span { display: block; transform: translateY(105%); }
.line-mask.in > span {
  transform: none;
  transition: transform 1.15s var(--ease-out);
  transition-delay: var(--delay, 0ms);
}

html.no-js [data-reveal] { opacity: 1; transform: none; }
html.no-js .line-mask > span { transform: none; }
html.no-js [data-wipe] > * { clip-path: none; }

@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;
  }
  [data-reveal] { opacity: 1; transform: none; }
  [data-wipe] > * { clip-path: none; }
  .line-mask > span { transform: none; }
  .marquee-track { transform: none !important; }
}


/* ------------------------------------------------- work sub-menu
   The five service lines, shown under "Work" on hover or keyboard
   focus.

   DELIBERATELY NO PANEL BACKGROUND. .site-head is painted with
   mix-blend-mode: difference so the nav stays legible over any
   section, light or dark. A child cannot opt out of its parent's
   blend, so a solid dropdown card would invert against whatever is
   behind it. Letting the sub-links inherit the same blending as the
   rest of the nav is both consistent and reliable.

   The panel sits flush at top:100% and carries its own padding-top -
   a gap there would be dead space that closes the menu as the mouse
   crosses it. */
.nav-group { position: relative; display: inline-flex; flex-direction: column; }
.nav-sub {
  position: absolute; top: 100%; left: 0;
  display: grid; gap: 0.4rem;
  padding: 0.85rem 0 0.5rem;
  opacity: 0; visibility: hidden; transform: translateY(-0.3rem);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out),
              visibility 0s linear 0.3s;
}
.nav-group:hover .nav-sub,
.nav-group:focus-within .nav-sub {
  opacity: 1; visibility: visible; transform: translateY(0);
  transition-delay: 0s, 0s, 0s;
}
.nav-sub a { white-space: nowrap; }

@media (max-width: 860px) {
  /* In the full-screen mobile menu there is nothing to hover, so the
     sub-items are simply listed under Work, a size down. */
  .nav-group { display: block; }
  .nav-sub {
    position: static; opacity: 1; visibility: visible; transform: none;
    padding: 0.2rem 0 0.8rem; gap: 0;
  }
  .nav-sub a {
    font-size: clamp(1rem, 4.4vw, 1.5rem);
    letter-spacing: var(--ls-meta);
    line-height: 1.65;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-sub { transition: none; }
}

/* The "Selected work" row disappears entirely when there are no
   projects, instead of leaving an empty gap on the home page. */
.wrap.section:has(> .work-grid.is-empty) { display: none; }
.work-empty { color: var(--ink-2); }


/* ==================================================== the tools site
   hktoolsarchviz.com only. Everything here is scoped under .site-tools,
   which sits on <html> of those pages, so none of it can reach the
   portfolio even though the two sites share this one stylesheet.

   This is a PRODUCT page, not an editorial one: centred, quiet, a lot
   of air, and the product picture doing the talking. The portfolio
   keeps its own left-aligned editorial voice.                        */

.site-tools { scroll-behavior: auto; }

/* The tools headline sits a step below the portfolio's, which is the
   loudest thing on that site by design. Same shape, smaller voice. */
.site-tools .display { font-size: clamp(2.1rem, 5.4vw, 5.4rem); }

/* ------------------------------------------------------- shared bits */
.t-center { text-align: center; }
.t-narrow { max-width: 54ch; margin-inline: auto; }
.t-sec { padding-block: clamp(4rem, 11vw, 10rem); }
.t-sec-tight { padding-block: clamp(2.5rem, 6vw, 5rem); }

.t-eyebrow {
  font-size: var(--t-meta); letter-spacing: var(--ls-meta);
  text-transform: uppercase; color: var(--ink-2);
  margin: 0 0 clamp(0.8rem, 1.6vw, 1.3rem);
}

/* The one really large line on the page. Tighter tracking than the
   portfolio's display, because it is centred and short. */
.t-head {
  font-size: clamp(2.4rem, 6.4vw, 6rem);
  line-height: 0.95; letter-spacing: -0.035em; font-weight: 400;
  margin: 0;
}
.t-sub {
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  line-height: 1.4; font-weight: 300; color: var(--ink-2);
  margin: clamp(1rem, 2vw, 1.6rem) auto 0; max-width: 46ch;
}

/* A section that is one big sentence. */
.t-say {
  font-size: clamp(1.5rem, 3.6vw, 3.1rem);
  line-height: 1.18; letter-spacing: -0.025em; font-weight: 300;
  margin: 0 auto; max-width: 24ch;
}
.t-say b { font-weight: 500; }

/* ----------------------------------------------------------- picture */
.t-shot { margin: 0; }
.t-shot img {
  display: block; width: 100%; height: auto; border-radius: 3px;
  background: var(--paper-2);
}
.t-shot figcaption {
  margin-top: clamp(0.8rem, 1.4vw, 1.1rem);
  font-size: var(--t-meta); letter-spacing: var(--ls-meta);
  text-transform: uppercase; color: var(--ink-2); text-align: center;
}
/* The interface shot is tall; left alone it would push the page out of
   sight, so it is capped and centred. */
.t-shot-ui img { max-width: 1040px; margin-inline: auto; }

/* Full-bleed band: the image runs edge to edge of the window. */
.t-bleed { width: 100%; }
.t-bleed img { border-radius: 0; }

/* ------------------------------------------------------- dark panels */
.t-dark {
  background: var(--black, #111); color: var(--paper);
}
.t-dark .t-eyebrow,
.t-dark .t-sub,
.t-dark .t-shot figcaption { color: rgba(242, 241, 238, 0.62); }

/* ------------------------------------------------------ feature grid */
.t-feats {
  display: grid; gap: clamp(2rem, 4.5vw, 4rem);
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
}
.t-feat h3 {
  font-size: clamp(1rem, 1.5vw, 1.2rem); line-height: 1.25;
  letter-spacing: -0.015em; text-transform: none; font-weight: 500;
  margin: 0 0 0.6rem;
}
.t-feat p { margin: 0; color: var(--ink-2); font-size: 0.97rem; line-height: 1.6; }

/* ------------------------------------------------------------- specs */
.t-specs {
  display: grid; gap: clamp(1.2rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 45%), 1fr));
  border-top: 1px solid var(--sand); padding-top: clamp(1.8rem, 3.5vw, 3rem);
}
.t-spec dt {
  font-size: var(--t-meta); letter-spacing: var(--ls-meta);
  text-transform: uppercase; color: var(--ink-2); margin: 0 0 0.4rem;
}
.t-spec dd {
  margin: 0; font-size: clamp(1rem, 1.5vw, 1.15rem); line-height: 1.35;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------- download */
.t-dl-wrap { display: grid; justify-items: center; gap: 0.9rem; }
.t-dl {
  display: inline-block; background: var(--ink); color: var(--paper);
  padding: 1.05rem 2.6rem; border-radius: 999px;
  font-size: clamp(0.95rem, 1.3vw, 1.05rem); letter-spacing: -0.01em;
  font-weight: 500; white-space: nowrap;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
}
.t-dl:hover { opacity: 0.86; transform: translateY(-1px); }
.t-dl:active { transform: translateY(1px); }
.t-dark .t-dl { background: var(--paper); color: var(--ink); }
.t-dl-note { margin: 0; color: var(--ink-2); font-size: 0.92rem; }
.t-dark .t-dl-note { color: rgba(242, 241, 238, 0.62); }

/* ------------------------------------------------- sticky product bar
   Appears once the hero has scrolled away: the product name on the left
   and the download button always within reach on the right. */
.t-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 95;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.75rem var(--gutter);
  background: rgba(242, 241, 238, 0.82);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--sand);
  transform: translateY(-105%);
  transition: transform 0.45s var(--ease-out);
}
.t-bar.on { transform: translateY(0); }
.t-bar-name { font-size: 0.95rem; letter-spacing: -0.015em; font-weight: 500; }
.t-bar .t-dl { padding: 0.55rem 1.4rem; font-size: 0.88rem; }
@media (max-width: 560px) { .t-bar-name { font-size: 0.85rem; } }

@media (prefers-reduced-motion: reduce) {
  .t-bar, .t-dl { transition: none; }
}
