@font-face {
  font-family: 'DOC NIL Phi Flex';
  src: url('/assets/fonts/roboto-flex-latin-variable.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  font-display: swap;
}
.phi-lab-page {
  --phi-paper: #eee5d0;
  --phi-ink: #322e24;
  --phi-gold: #c6ad76;
  --phi-line: #d3bb863b;
  background: #0c100f;
  color: var(--phi-paper);
  overflow: clip;
}
.phi-lab-page :is(button, input) { font: inherit; }
.phi-lab-page :is(button, a, input):focus-visible { outline: 2px solid #b68436; outline-offset: 5px; }
.phi-lab-page :is(button, a) { -webkit-tap-highlight-color: transparent; }
.phi-lab-page button { min-height: 44px; border: 1px solid currentColor; padding: 10px 16px; background: transparent; color: inherit; cursor: pointer; }
.phi-lab-page button:disabled { opacity: .48; cursor: default; }
.phi-lab-page button[aria-pressed=true] { background: var(--phi-gold); border-color: var(--phi-gold); color: #161a16; }
.phi-lab-page input[type=range] { width: 100%; min-height: 28px; accent-color: #94713e; cursor: ew-resize; }
.phi-lab-page .page-kicker { color: inherit; font-size: 10px; letter-spacing: .12em; }
.phi-intro {
  display: grid; grid-template-columns: 1.1fr .9fr; align-items: end; gap: 5vw;
  padding: 160px var(--pad, 36px) 72px;
  background: radial-gradient(ellipse at 66% 20%, #6353311a, transparent 65%);
}
.phi-intro h1 { font: 400 clamp(64px, 8.5vw, 138px)/.96 var(--serif, Georgia, serif); letter-spacing: -.065em; margin: 26px 0 0; }
.phi-lab-page :is(h1,h2) em { color: var(--phi-gold); }
.phi-intro-copy p { max-width: 42ch; font: 16px/1.75 var(--sans, sans-serif); }
.phi-chapters { display: flex; gap: 22px; flex-wrap: wrap; border-top: 1px solid var(--phi-line); padding-top: 16px; margin-top: 30px; font: 11px/1.6 var(--mono, monospace); }
.phi-chapters a { display: inline-flex; min-height: 44px; align-items: center; }
.phi-material-section, .phi-xray-section, .phi-type-section { padding: 72px var(--pad, 36px); scroll-margin-top: 98px; }
.phi-section-heading { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8%; align-items: end; margin-bottom: 32px; }
.phi-section-heading>.page-kicker { grid-column: 1 / -1; margin-bottom: 22px; }
.phi-section-heading h2 { font: 400 clamp(40px, 5.2vw, 80px)/1.02 var(--serif, Georgia, serif); letter-spacing: -.05em; margin: 0; }
.phi-section-heading>p:last-child { max-width: 43ch; font: 14px/1.8 var(--sans, sans-serif); margin: 0; }
.phi-material-figure { margin: 0; }
.phi-material-stage { position: relative; width: 100%; isolation: isolate; aspect-ratio: 1.8; min-height: 310px; max-height: 74vh; background: #090d0c; border: 1px solid var(--phi-line); overflow: hidden; touch-action: pan-y; }
.phi-material-stage>canvas { display: block; width: 100%; height: 100%; }
.phi-vector-overlay { position: absolute; inset: 0; pointer-events: none; color: #b49a62; opacity: .45; overflow: hidden; }
.phi-vector-overlay svg { display: block; width: 100%; height: 100%; }
.phi-vector-overlay[hidden] { display: none; }
.phi-divider-handle { position: absolute; top: 0; bottom: 0; width: 36px; margin-left: -18px; left: 61.803%; cursor: ew-resize; touch-action: none; }
.phi-divider-handle::before { content: ''; position: absolute; top: 0; bottom: 0; left: 17px; width: 1px; background: #d2b77b70; }
.phi-divider-handle span { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); padding: 6px 9px; font: 9px/1.5 var(--mono, monospace); color: #e9dbb8; background: #111a15; border: 1px solid #b39b6780; }
.phi-divider-handle[data-locked=true] { cursor: default; }
.phi-stage-index, .phi-stage-formula { position: absolute; color: #bfa777; font: 10px/1.6 var(--mono, monospace); pointer-events: none; }
.phi-stage-index { left: 24px; top: 22px; }
.phi-stage-formula { right: 24px; bottom: 22px; }
.phi-material-figure figcaption { display: flex; justify-content: space-between; gap: 20px; padding: 14px 0; font: 10px/1.7 var(--mono, monospace); color: #c6c0b1; }
.phi-control-deck { display: grid; grid-template-columns: 1fr .65fr 1.7fr; align-items: center; gap: 30px; border-top: 1px solid var(--phi-line); padding-top: 18px; }
.phi-control { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; color: inherit; font: 11px/1.6 var(--mono, monospace); margin: 0; }
.phi-control input { grid-column: 1 / -1; color: inherit; }
.phi-control output { font-variant-numeric: tabular-nums; }
.phi-ratio-readout { display: grid; gap: 7px; font: 10px/1.5 var(--mono, monospace); }
.phi-ratio-readout output { font-size: clamp(16px, 1.8vw, 24px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.phi-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 11px/1.6 var(--mono, monospace); }
.phi-actions a { display: inline-flex; align-items: center; min-height: 44px; border-bottom: 1px solid currentColor; }
.phi-folio-note { display: flex; justify-content: space-between; gap: 20px; padding-block: 8px; font: 10px/1.8 var(--mono, monospace); opacity: .8; }
.phi-xray-section { background: var(--phi-paper); color: var(--phi-ink); --phi-gold: #81633b; --phi-line: #322e2440; }
.phi-xray-layout { display: grid; grid-template-columns: 1.55fr 1fr; gap: 5%; }
.phi-dropzone { padding: 16px; border: 1px solid #8b755345; background: #e6dac2; }
.phi-dropzone[data-dragging=true] { outline: 2px solid #81633b; outline-offset: 5px; }
.phi-logo-board { position: relative; aspect-ratio: 1.618; background: #f8f3e8; overflow: hidden; }
.phi-logo-board img { position: absolute; inset: 10%; width: 80%; height: 80%; object-fit: contain; }
.phi-logo-board .phi-vector-overlay { color: #70582f; opacity: .6; }
.phi-logo-board .phi-empty-mark { position: absolute; inset: 0; display: grid; place-content: center; font: italic clamp(90px, 14vw, 210px)/1 Georgia,serif; color: #74674b38; }
.phi-centroid { position: absolute; width: 13px; height: 13px; border: 1px solid #854e29; background: #f1dfaf; border-radius: 50%; transform: translate(-50%,-50%); pointer-events: none; box-shadow: 0 0 0 4px #f8f3e8b3; }
.phi-upload { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; color: inherit; padding: 16px 2px 2px; font: 11px/1.6 var(--mono,monospace); }
.phi-upload input { width: 100%; min-height: 44px; color: inherit; }
.phi-upload input::file-selector-button { min-height: 40px; color: inherit; background: transparent; border: 1px solid currentColor; margin-right: 12px; padding: 8px 12px; cursor: pointer; }
.phi-upload-note { font: 10px/1.8 var(--mono,monospace); max-width: 65ch; }
.phi-analysis h3 { font: 400 clamp(27px, 3vw, 43px)/1.1 var(--serif,Georgia,serif); letter-spacing: -.035em; margin: 0 0 14px; }
.phi-analysis>p:not(.page-kicker) { font: 12px/1.8 var(--sans,sans-serif); }
.phi-metrics { margin: 26px 0; }
.phi-metrics>div { display: flex; justify-content: space-between; gap: 15px; border-top: 1px solid var(--phi-line); padding: 13px 0; font: 11px/1.65 var(--mono,monospace); }
.phi-metrics dd { margin: 0; font-variant-numeric: tabular-nums; }
.phi-method { opacity: .85; }
.phi-type-section { background: #111713; }
.phi-type-controls { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 26px; align-items: end; }
.phi-name-control input, .phi-base-control input { min-height: 44px; width: 100%; padding: 9px 12px; background: transparent; border: 1px solid #cdb78b80; font: 16px/1.4 var(--sans,sans-serif); border-radius: 0; }
.phi-type-stage { position: relative; isolation: isolate; margin: 34px 0 10px; min-height: 270px; display: grid; place-items: center; padding: 36px 24px; overflow: hidden; border-top: 1px solid var(--phi-line); border-bottom: 1px solid var(--phi-line); }
.phi-type-specimen { display: block; text-align: center; font-family: 'DOC NIL Phi Flex', sans-serif; font-size: clamp(46px, 8.5vw, 138px); line-height: 1.3; font-weight: 420; font-stretch: 100%; color: var(--phi-paper); white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }
.phi-type-specimen[data-phi-type-rendered=true] { color: transparent; }
.phi-type-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.phi-type-axis { position: absolute; left: 14px; bottom: 14px; font: 9px/1.5 var(--mono,monospace); color: #b6a581; pointer-events: none; }
.phi-scale-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 8%; margin-top: 48px; }
.phi-scale-layout h3 { font: 400 clamp(32px,4vw,54px)/1.1 var(--serif,Georgia,serif); letter-spacing: -.04em; margin: 0 0 18px; }
.phi-scale-layout p { font: 13px/1.8 var(--sans,sans-serif); max-width: 46ch; }
.phi-base-control { max-width: 200px; margin: 20px 0; }
.phi-scale-table { overflow-x: auto; }
.phi-scale-table table { width: 100%; border-collapse: collapse; font: 12px/1.7 var(--mono,monospace); font-variant-numeric: tabular-nums; }
.phi-scale-table :is(th,td) { border-bottom: 1px solid var(--phi-line); padding: 12px; text-align: right; }
.phi-scale-table :is(th,td):first-child { text-align: left; }
.phi-scale-table caption { text-align: left; padding: 0 12px 15px; }
.phi-context { max-width: 1000px; padding-block: 76px; }
.phi-context h2 { font: 400 clamp(40px,5vw,72px)/1 var(--serif,Georgia,serif); letter-spacing: -.045em; }
.phi-context p:not(.page-kicker) { font: 14px/1.8 var(--sans,sans-serif); max-width: 67ch; }
.phi-context .phi-actions { margin-top: 28px; gap: 24px; }
.phi-lab-page [hidden] { display: none; }
@media(max-width:1000px) {
  .phi-control-deck { grid-template-columns: 1fr 1fr; }
  .phi-control-deck .phi-actions { grid-column: 1 / -1; }
  .phi-xray-layout { gap: 28px; }
}
@media(max-width:700px) {
  .phi-intro { grid-template-columns: 1fr; padding-top: 124px; gap: 28px; padding-bottom: 44px; }
  .phi-intro h1 { font-size: clamp(55px,14vw,88px); }
  .phi-material-section, .phi-xray-section, .phi-type-section { padding-block: 46px; }
  .phi-section-heading, .phi-xray-layout, .phi-scale-layout { grid-template-columns: 1fr; gap: 24px; }
  .phi-section-heading>.page-kicker { margin-bottom: 0; }
  .phi-material-stage { aspect-ratio: 1.15; min-height: 300px; max-height: none; }
  .phi-stage-index { left: 14px; top: 14px; }
  .phi-stage-formula { right: 14px; bottom: 16px; font-size: 8px; }
  .phi-material-figure figcaption { display: grid; gap: 4px; }
  .phi-folio-note { display: block; }
  .phi-control-deck { gap: 18px; }
  .phi-type-controls { grid-template-columns: 1fr 1fr; gap: 20px; }
  .phi-name-control { grid-column: 1 / -1; }
  .phi-type-stage { min-height: 210px; padding-inline: 14px; }
  .phi-type-specimen { font-size: clamp(35px,10vw,62px); }
  .phi-chapters { gap: 18px; }
}
@media(prefers-reduced-motion:reduce) {
  .phi-lab-page *, .phi-lab-page *::before, .phi-lab-page *::after { scroll-behavior: auto; transition: none; animation: none; }
}
.phi-logo-board .phi-vector-overlay [stroke] { stroke: #7c6540; }
.phi-logo-board .phi-vector-overlay [fill]:not([fill=none]) { fill: #70582f; }
