/* Portfolio styles */

@font-face { font-family: "Clash Grotesk"; src: url("assets/fonts/clash-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Clash Grotesk"; src: url("assets/fonts/clash-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Clash Grotesk"; src: url("assets/fonts/clash-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --paper: #f2f2f1;
  --paper-2: #e3e3e1;
  --ink: #151515;
  --muted: #474746;
  --blue: #2f5bd3;
  --blue-strong: #2148b4;
  --blue-tint: #dbe3f7;
  --on-blue: #ffffff;

  --font: "Clash Grotesk", "Helvetica Neue", Arial, sans-serif;
  /* type scale */
  --step-small: 0.9375rem;
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.375rem, 1.1rem + 0.8vw, 1.75rem);
  --step-head: clamp(2.5rem, 1.5rem + 3.2vw, 4rem);
  --step-display: clamp(3.25rem, 0.9rem + 6.6vw, 7.5rem);

  --margin: clamp(16px, 1.4vw, 20px);
  --gap: 12px;
  --section: clamp(96px, 12vw, 200px);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-press: 120ms;
  --t-hover: 180ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-color: var(--ink) var(--paper-2); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.45;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, dl, dd, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--blue); color: var(--on-blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { left: var(--margin); top: var(--margin); width: auto; height: auto; clip: auto; z-index: 10; background: var(--ink); color: var(--paper); padding: 10px 14px; text-decoration: none; }

/* Shared */
.cap { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; font-size: var(--step-small); color: var(--ink); }
.cap span:last-child { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  background: var(--blue); color: var(--on-blue);
  font-size: var(--step-body); font-weight: 500; text-decoration: none;
  border-radius: 0;
  transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease;
}
.button:active { transform: scale(0.97); }
.ul { text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 0.06em; transition: color var(--t-hover) ease; }
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--blue-strong); }
  .ul:hover { color: var(--blue); }
}

/* Tensor-network diagrams */
.chain .bond, .block-diagram .bond { stroke: var(--blue); stroke-width: 3; }
.chain .legs line, .block-diagram .legs line { stroke: currentColor; stroke-width: 2; }
.chain .nodes circle, .block-diagram .nodes circle { fill: var(--paper); stroke: currentColor; stroke-width: 2; }
.block-diagram { color: var(--ink); width: 100%; height: auto; }
.block-diagram .trap { fill: var(--paper-2); stroke: none; }
.block-diagram text { font-family: var(--font); font-size: 22px; fill: var(--ink); }

/* Hero */
.hero { height: 100svh; min-height: 640px; overflow: hidden; position: relative; }
.sheet {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,2.6fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);
  gap: var(--gap);
  padding: 0 var(--margin);
  height: 100%;
}
.col { min-width: 0; display: flex; flex-direction: column; gap: var(--gap); transform: translateY(var(--off)); will-change: transform; }
.col-panel { padding-top: 0; }
.frame { position: relative; background: var(--paper-2); }
.frame img { width: 100%; height: auto; aspect-ratio: auto; object-fit: cover; }
.strip {
  height: 28px; display: flex; align-items: center; padding: 0 8px;
  font-size: var(--step-small); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.s1 { background: var(--ink); color: var(--paper); }
.s2 { background: var(--blue); color: var(--on-blue); }
.s3 { background: var(--paper-2); color: var(--ink); }
.s4 { background: var(--blue-tint); color: var(--ink); }

.panel {
  background: var(--ink); color: var(--paper);
  padding: 24px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 20px;
  margin-top: 4vh;
}
.panel h1 { font-size: var(--step-display); font-weight: 500; letter-spacing: -0.04em; line-height: 0.88; }
.panel h1 span { display: block; }
.panel-line { font-size: var(--step-lead); line-height: 1.3; max-width: 24ch; }
.panel-sub { font-size: var(--step-body); color: #d6d6d3; max-width: 40ch; line-height: 1.45; }
.chain-panel { color: var(--paper); width: 100%; max-width: 300px; height: auto; }
.chain-panel .nodes circle { fill: var(--ink); }
.chain-panel .bond { stroke: #7f9cf0; }
.panel .button { margin-top: 4px; }
.panel-links { display: flex; gap: 18px; font-size: var(--step-small); }
.panel-links a { color: var(--paper); text-underline-offset: 0.22em; text-decoration-thickness: 0.06em; }
@media (hover: hover) and (pointer: fine) { .panel-links a:hover { color: #9fb6f5; } }

/* HybridQTN */
.showcase {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap);
  padding: var(--section) var(--margin) 0;
}
.sc-notes { grid-column: 1 / span 3; display: flex; flex-direction: column; gap: 20px; padding-right: 12px; }
.sc-notes h2 { font-size: var(--step-head); font-weight: 500; letter-spacing: -0.03em; line-height: 0.95; }
.sc-links a { font-size: var(--step-body); text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 0.06em; }
.sc-lede { font-size: var(--step-body); }
.facts { display: grid; gap: 14px; margin-top: 12px; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: var(--step-small); color: var(--muted); }
.facts dd { font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.sc-note { font-size: var(--step-body); color: var(--ink); max-width: 46ch; }

.sc-stage { grid-column: 4 / -1; min-width: 0; }
.run { display: flex; align-items: flex-end; gap: 6px; }
.run .small { flex: 0 0 auto; width: 21vh; max-width: 230px; }
.run .small img { width: 100%; aspect-ratio: 1; }
.lifted { flex: 0 0 auto; width: min(46vh, 480px); }
.viewer-img { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--ink); }
.viewer-img img { width: 100%; height: 100%; object-fit: cover; }
.overlay {
  position: absolute; inset: 0;
  background: var(--blue);
  opacity: 0.62;
  -webkit-mask: var(--m) center / 100% 100% no-repeat;
  mask: var(--m) center / 100% 100% no-repeat;
  transition: opacity 220ms ease;
}
.overlay.is-off { opacity: 0; }

.controls { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px 24px; margin-top: 28px; max-width: 980px; }
.ctl-title { font-size: var(--step-small); color: var(--muted); }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button {
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 0; cursor: pointer;
  background: var(--paper-2); color: var(--ink); font-size: var(--step-small);
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.seg button:active, .cases button:active { transform: scale(0.97); }
.cases { display: flex; flex-wrap: wrap; gap: 6px; }
.cases button { width: 56px; height: 56px; padding: 0; border: 0; border-radius: 0; cursor: pointer; background: var(--paper-2); position: relative; transition: transform var(--t-press) var(--ease-out); }
.cases button img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; transition: opacity var(--t-hover) ease; }
.cases button[aria-pressed="true"] { outline: 3px solid var(--blue); outline-offset: 2px; }
.cases button[aria-pressed="true"] img { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  .seg button:hover { background: var(--blue-tint); }
  .seg button[aria-pressed="true"]:hover { background: var(--ink); }
  .cases button:hover img { opacity: 1; }
}
.ctl-note { grid-column: 1 / -1; font-size: var(--step-body); min-height: 1.45em; }
.ctl-fine { grid-column: 1 / -1; font-size: var(--step-body); color: var(--muted); max-width: 70ch; }

.sc-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px var(--gap); margin-top: 72px; align-items: end; }
.fig img { width: 100%; height: auto; background: #fff; }
.fig video { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--ink); }
.fig-wide { grid-column: 1 / -1; max-width: 820px; }
.fig-clip { position: relative; }
.clip-toggle {
  position: absolute; top: 12px; right: 12px;
  min-height: 44px; padding: 0 16px; border: 0; border-radius: 0; cursor: pointer;
  background: var(--ink); color: var(--paper); font-size: var(--step-small);
  transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.clip-toggle:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .clip-toggle:hover { background: var(--blue); } }
.fig .block-diagram { background: var(--paper); }

/* Project index */
.index { padding: var(--section) var(--margin) 96px; }
.index-head { display: flex; align-items: baseline; gap: 32px; margin-bottom: 28px; flex-wrap: wrap; }
.index-head h2 { font-size: var(--step-head); font-weight: 500; letter-spacing: -0.03em; line-height: 0.95; }
.index-head p { font-size: var(--step-body); max-width: 56ch; }
.shelf { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.shelf li { flex: 0 0 auto; }
.shelf a, .shelf .nolink {
  writing-mode: vertical-rl;
  display: flex; align-items: center; gap: 12px;
  width: 38px; height: 440px; padding: 12px 0;
  background: var(--paper-2); color: var(--ink);
  text-decoration: none; font-size: var(--step-body); line-height: 1; white-space: nowrap;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.shelf .nolink { background: transparent; }
.shelf .k { padding: 8px 4px; font-size: var(--step-small); }
.k-r { background: var(--blue); color: var(--on-blue); }
.k-o { background: var(--blue-tint); color: var(--ink); }
.k-e { background: var(--ink); color: var(--paper); }
.k-t { background: var(--paper); color: var(--ink); }
.shelf a:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .shelf a:hover { background: var(--ink); color: var(--paper); }
}
.shelf a:focus-visible { background: var(--ink); color: var(--paper); }

/* About */
.about { padding: var(--section) var(--margin) 0; }
.about-h { font-size: var(--step-head); font-weight: 500; letter-spacing: -0.03em; line-height: 0.95; margin-bottom: 48px; }
.about-row { display: grid; grid-template-columns: 34% 1fr; column-gap: 0; }
.side-facts { display: grid; gap: 20px; width: 240px; align-content: start; }
.side-facts dt { font-size: var(--step-small); color: var(--muted); }
.side-facts dd { font-size: var(--step-body); }
.about-p { font-size: var(--step-lead); line-height: 1.35; max-width: 34em; }
.records { margin-top: 120px; }
.rec-word { font-size: var(--step-small); color: var(--muted); }
.rec-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; max-width: 980px; }
.rec-lists h3 { font-size: var(--step-body); font-weight: 600; margin-bottom: 12px; }
.rec li { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; font-size: var(--step-body); }
.rec li span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Photos */
.gallery { position: relative; min-height: 78svh; display: flex; flex-direction: column; justify-content: center; padding: var(--section) 0 0; }
.g-title { position: relative; z-index: 2; margin: 0 var(--margin) -12px; font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.01em; }
.g-title .count { color: var(--muted); font-weight: 400; margin-left: 8px; }
.g-row {
  display: flex; gap: 5vw; overflow-x: auto; padding: 24px var(--margin) 24px;
  scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain;
}
.g-row::-webkit-scrollbar { display: none; }
.g-row img { flex: 0 0 auto; width: 11vw; min-width: 150px; height: 26svh; min-height: 220px; object-fit: cover; scroll-snap-align: start; transition: transform 250ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .g-row img:hover { transform: scale(1.1); } }

/* Contact */
.contact {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: var(--gap); align-items: start;
  padding: 160px var(--margin) 120px;
}
.contact-s { grid-column: 1 / span 6; font-size: var(--step-lead); line-height: 1.3; letter-spacing: -0.01em; font-weight: 500; max-width: 30ch; }
.contact-p { grid-column: 8 / span 2; width: 168px; height: 168px; object-fit: cover; object-position: 50% 30%; }
.contact-l { grid-column: 10 / -1; display: grid; gap: 8px; font-size: var(--step-body); }
.contact-q { font-weight: 500; margin-bottom: 12px; }
.contact-c { font-size: var(--step-small); color: var(--muted); margin-top: 10px; }

/* Footer */
.tiles {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px;
  padding: 0 var(--margin) var(--margin);
}
.tile { padding: 20px; background: var(--paper-2); display: flex; flex-direction: column; }
.t-state { grid-column: 1 / span 4; min-height: 220px; justify-content: space-between; gap: 16px; }
.t-big { font-size: var(--step-lead); line-height: 1.3; max-width: 24ch; }
.t-legal { font-size: var(--step-small); color: var(--muted); }
.t-nav { grid-column: 5 / span 3; }
.t-nav ul { display: grid; gap: 6px; }
.t-nav a { text-decoration: none; font-size: var(--step-body); }
.t-time { grid-column: 8 / span 2; justify-content: space-between; }
.t-time p:first-child { font-size: var(--step-small); color: var(--muted); }
.t-clock { font-size: var(--step-head); font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.t-mail { grid-column: 10 / -1; justify-content: flex-end; }
.t-mail a { font-size: var(--step-body); text-underline-offset: 0.22em; text-decoration-thickness: 0.06em; overflow-wrap: anywhere; }
.t-word { grid-column: 1 / span 8; min-height: 320px; background: var(--ink); color: var(--paper); align-items: center; justify-content: center; overflow: hidden; }
.t-word span { font-size: var(--step-display); font-weight: 500; letter-spacing: -0.04em; line-height: 1; white-space: nowrap; }
.t-cta { grid-column: 9 / -1; min-height: 320px; background: var(--blue); color: var(--on-blue); text-decoration: none; justify-content: space-between; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.t-cta span { font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.01em; }
.t-cta svg { align-self: flex-end; transition: transform 300ms var(--ease-out); }
.t-cta:active { transform: scale(0.99); }
@media (hover: hover) and (pointer: fine) {
  .t-nav a:hover, .t-mail a:hover { color: var(--blue); }
  .t-cta:hover { background: var(--blue-strong); }
  .t-cta:hover svg { transform: translate(4px, -4px); }
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out); transition-delay: calc(var(--i, 0) * 75ms); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
  .js .shutter { clip-path: inset(0 0 100% 0); transition: clip-path 1100ms var(--ease-in-out); }
  .js .shutter img { transform: scale(1.12); transition: transform 1500ms var(--ease-out); }
  .js .shutter.is-in { clip-path: inset(0); }
  .js .shutter.is-in img { transform: none; }
  .js .hero .frame, .js .hero .panel { animation: rise 900ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 45ms); }
  @keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
  .viewer-img img { transition: opacity 260ms ease; }
  .viewer-img.is-swapping img { opacity: 0.4; }
}

/* Tablet */
@media (max-width: 1100px) {
  .sheet { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,2.8fr) minmax(0,1fr); }
  .sheet .col:nth-child(5), .sheet .col:nth-child(6), .sheet .col:nth-child(7) { display: none; }
  .sc-notes { grid-column: 1 / -1; padding-right: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; }
  .sc-notes h2, .sc-links { grid-column: 1 / -1; }
  .sc-stage { grid-column: 1 / -1; margin-top: 48px; }
  .showcase { padding-top: calc(var(--section) + 40px); }
  .run { overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
  .run::-webkit-scrollbar { display: none; }
  .lifted { width: min(52vw, 440px); }
  .run .small { width: 26vw; }
  .index-head { flex-direction: column; gap: 12px; }
  .shelf { flex-wrap: wrap; overflow: visible; gap: 10px; }
  .shelf a, .shelf .nolink { writing-mode: horizontal-tb; width: auto; height: auto; padding: 6px 0 6px 8px; gap: 8px; }
  .shelf .k { padding: 6px 8px; }
  .records { grid-template-columns: 1fr; }
  .rec-word { display: none; }
  .contact-s { grid-column: 1 / span 6; }
  .contact-p { grid-column: 7 / span 2; width: 140px; height: 140px; }
  .contact-l { grid-column: 9 / -1; }
}

/* Phone */
@media (max-width: 720px) {
  :root { --gap: 8px; --section: 96px; }
  .hero { height: auto; min-height: 0; overflow: visible; }
  .sheet { display: grid; grid-template-columns: 1fr 1fr; padding: 0 var(--margin); }
  .col { display: contents; transform: none !important; }
  .col .frame:nth-of-type(n+2), .sheet .col:nth-child(n+5) .frame { display: none; }
  .sheet .col:nth-child(5), .sheet .col:nth-child(6), .sheet .col:nth-child(7) { display: contents; }
  .sheet .col:nth-child(5) .frame, .sheet .col:nth-child(7) .frame { display: none; }
  .frame img { aspect-ratio: 4 / 3; height: auto; }
  .panel { grid-column: 1 / -1; order: -1; margin: 0 calc(var(--margin) * -1) 8px; min-height: 0; padding: 28px var(--margin) 24px; }
  .panel h1 { font-size: 15vw; }
  .panel-line { max-width: none; }
  .panel .button { width: 100%; }
  .chain-panel { margin-top: 0; }

  .showcase { display: block; }
  .sc-notes { display: flex; }
  .run { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory; margin-right: calc(var(--margin) * -1); padding-right: var(--margin); align-items: flex-start; flex-direction: row; }
  .lifted { width: calc(100vw - 2 * var(--margin)); scroll-snap-align: start; }
  .run .small { width: 34vw; scroll-snap-align: start; }
  .controls { grid-template-columns: 1fr; gap: 10px; }
  .cases button { width: calc((100% - 30px) / 6); height: auto; aspect-ratio: 1; }
  .sc-figs { grid-template-columns: 1fr; margin-top: 48px; }

  .shelf { flex-wrap: wrap; overflow: visible; gap: 10px 10px; }
  .shelf a, .shelf .nolink { writing-mode: horizontal-tb; width: auto; height: auto; padding: 6px 0 6px 8px; gap: 8px; }
  .shelf .k { padding: 6px 8px; }

  .about-row { grid-template-columns: 1fr; }
  .about-p { order: -1; margin-bottom: 32px; }
  .side-facts { width: auto; grid-template-columns: 1fr 1fr; gap: 16px; }
  .records { margin-top: 56px; }
  .rec-word { display: none; }
  .rec-lists { grid-template-columns: 1fr; gap: 40px; }

  .gallery { min-height: 0; padding-top: var(--section); }
  .g-title { margin-bottom: 8px; }
  .g-row { gap: 5vw; scroll-snap-type: x mandatory; }
  .g-row img { width: 34vw; min-width: 0; height: auto; min-height: 0; aspect-ratio: 2 / 3; }

  .contact { display: grid; grid-template-columns: 96px 1fr; gap: 24px 16px; padding: 96px var(--margin) 120px; }
  .contact-s { grid-column: 1 / -1; }
  .contact-p { grid-column: 1; width: 96px; height: 96px; }
  .contact-l { grid-column: 2; }
  .contact-c { grid-column: 1 / -1; }

  .tiles { grid-template-columns: 1fr 1fr; gap: 6px; grid-auto-flow: dense; }
  .tile { min-height: 0; }
  .t-word { grid-column: 1 / -1; order: -2; min-height: 160px; }
  .t-word span { font-size: 15vw; white-space: normal; line-height: 0.9; text-align: center; }
  .t-cta { grid-column: 1 / -1; order: -1; min-height: 140px; }
  .t-nav { grid-column: 1; }
  .t-mail { grid-column: 1 / -1; }
  .t-time { grid-column: 1; min-height: 120px; }
  .t-state { grid-column: 2; min-height: 0; }
  .t-clock { font-size: var(--step-lead); }
}
