/* ===================================================================
   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. Scoped under .site-tools, which sits on
   <html> of those pages, so none of it can reach the portfolio even
   though both sites share this one stylesheet.                      */

/* 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); }

/* ---------------------------------------------------- product block */
.product { padding-top: clamp(1rem, 2vw, 2rem); }
.product-head { max-width: 62ch; }
.product-no { color: var(--ink-2); margin-bottom: clamp(0.6rem, 1vw, 0.9rem); }
.product-name { margin: 0; }
.product-tag {
  font-size: clamp(1.1rem, 2.4vw, 1.8rem);
  line-height: 1.2; letter-spacing: -0.02em; font-weight: 300;
  margin: clamp(0.5rem, 1vw, 0.8rem) 0 clamp(1.1rem, 2vw, 1.6rem);
}
.product-lede { max-width: 58ch; }

/* ------------------------------------------------------ screenshots */
.shot { margin: 0; }
.shot img {
  display: block; width: 100%; height: auto;
  border-radius: 2px; background: var(--paper-2);
}
.shot figcaption { margin-top: 0.7rem; }
.shot-wide { margin: clamp(2rem, 4vw, 3.5rem) 0; }
/* The UI shot is tall. Left to itself it would fill the screen and push
   everything below out of sight, so it is capped and centred. */
.shot-wide img { max-width: 1100px; margin-inline: auto; }

.shot-pair {
  display: grid; gap: clamp(1.2rem, 2.5vw, 2.2rem);
  grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
  margin: clamp(2rem, 4vw, 3.5rem) 0;
}

/* --------------------------------------------------- feature points */
.feat {
  display: grid; gap: clamp(1.4rem, 3vw, 2.6rem);
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  margin: clamp(2rem, 4vw, 3.2rem) 0;
  padding-top: clamp(1.6rem, 3vw, 2.4rem);
  border-top: 1px solid var(--sand);
}
.feat-item h3 { margin: 0 0 0.5rem; }
.feat-item p { margin: 0; font-size: 0.97rem; line-height: 1.55; }

/* ---------------------------------------------------- download band */
.get {
  display: grid; gap: clamp(1.2rem, 3vw, 2.5rem);
  grid-template-columns: 1fr auto; align-items: center;
  padding: clamp(1.6rem, 3vw, 2.4rem) 0 0;
  border-top: 1px solid var(--sand);
}
@media (max-width: 760px) { .get { grid-template-columns: 1fr; } }
.get-main { max-width: 52ch; }
.get-main h3 { margin: 0 0 0.5rem; }
.get-note { margin: 0; font-size: 0.97rem; line-height: 1.55; }
.get-side { display: grid; gap: 0.6rem; justify-items: start; }
@media (min-width: 761px) { .get-side { justify-items: end; } }

.btn-dl {
  display: inline-block; background: var(--ink); color: var(--paper);
  padding: 0.95rem 1.8rem; border-radius: 2px;
  font-size: var(--t-meta); letter-spacing: var(--ls-meta);
  text-transform: uppercase; white-space: nowrap;
  transition: background 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.btn-dl:hover { background: var(--sand); color: var(--ink); }
.btn-dl:active { transform: translateY(1px); }
.get-meta { margin: 0; }

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