:root, [data-theme="light"] {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --color-bg: #f7f6f2;
  --color-surface: #f9f8f5;
  --color-surface-2: #fbfbf9;
  --color-surface-offset: #f3f0ec;
  --color-border: #d4d1ca;
  --color-text: #28251d;
  --color-text-muted: #66635c;
  --color-text-inverse: #f9f8f4;
  --color-primary: #01696f;
  --color-primary-highlight: #cedcd8;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --content-default: 1100px;
  --font-body: 'Satoshi', Inter, sans-serif;
  --font-display: 'Boska', Georgia, serif;
}

[data-theme="dark"] {
  --color-bg: #171614;
  --color-surface: #1c1b19;
  --color-surface-2: #201f1d;
  --color-surface-offset: #1d1c1a;
  --color-border: #393836;
  --color-text: #cdccca;
  --color-text-muted: #a09e9a;
  --color-text-inverse: #2b2a28;
  --color-primary: #4f98a3;
  --color-primary-highlight: #313b3b;
  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
}

*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:none;text-size-adjust:none;scroll-behavior:smooth}
body{min-height:100dvh;background:var(--color-bg);color:var(--color-text);font-family:var(--font-body);font-size:var(--text-base);line-height:1.6}
button,input,select{font:inherit;color:inherit}button{cursor:pointer;border:none;background:none}a{text-decoration:none;color:inherit}code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.9em}

.container{width:min(calc(100% - 2rem),var(--content-default));margin-inline:auto}
.skip-link{position:absolute;left:var(--space-4);top:-100px;background:var(--color-primary);color:var(--color-text-inverse);padding:var(--space-3) var(--space-4);z-index:20}.skip-link:focus{top:var(--space-4)}

/* Header */
.site-header{position:sticky;top:0;z-index:10;background:color-mix(in oklab,var(--color-bg) 88%,transparent);backdrop-filter:blur(12px);border-bottom:1px solid oklch(from var(--color-text) l c h / 0.12)}
.nav,.nav-actions,.legend{display:flex}.nav{justify-content:space-between;align-items:center;gap:var(--space-4);padding:var(--space-4) 0}.nav-actions{gap:.5rem;align-items:center}
.brand{display:flex;align-items:center;gap:var(--space-3);font-weight:700;font-size:var(--text-sm)}.brand svg{width:34px;height:34px;padding:7px;border:1px solid oklch(from var(--color-text) l c h / 0.12);background:var(--color-surface)}
.icon-btn,.pill-btn{min-height:44px;border:1px solid oklch(from var(--color-text) l c h / 0.12);transition:all var(--transition-interactive);background:var(--color-surface)}.icon-btn{min-width:44px;display:grid;place-items:center}
.pill-btn{padding:0 var(--space-4);border-radius:0;display:inline-flex;align-items:center;justify-content:center;font-size:var(--text-sm);font-weight:600;letter-spacing:0.02em;white-space:nowrap}

/* Hero */
.hero{padding:clamp(var(--space-10),8vw,var(--space-20)) 0 var(--space-10)}.hero-grid{display:grid;grid-template-columns:1.2fr .8fr;gap:var(--space-8);align-items:end}
.eyebrow{font-size:var(--text-xs);text-transform:uppercase;letter-spacing:.12em;color:var(--color-text-muted);margin-bottom:var(--space-4)}
h1{font-family:var(--font-display);font-size:var(--text-3xl);line-height:.95;letter-spacing:-.03em;max-width:12ch}
.hero p{margin-top:var(--space-5);max-width:58ch;color:var(--color-text-muted)}
.note-card {
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.1);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  display: grid;
  gap: var(--space-3);
  border-radius: 0;
  overflow: hidden;
}
.note-card .mini, .label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note-card strong { font-size: var(--text-lg); line-height: 1.2; }
.value { font-size: var(--text-lg); line-height: 1.2; white-space: nowrap; }

/* Workspace */
.workspace{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(320px,.95fr);gap:var(--space-4);align-items:start;padding-bottom:var(--space-12)}
.control-stack{display:grid;gap:1rem}
.panel{background:var(--color-surface);border:1px solid oklch(from var(--color-text) l c h / 0.1);box-shadow:var(--shadow-sm);border-radius:0;padding:var(--space-5)}
.panel h2,.format-card h3{font-size:var(--text-lg);margin-bottom:var(--space-4)}

/* Fields */
.field{display:grid;gap:var(--space-2);margin-bottom:var(--space-4)}.field label{font-size:var(--text-sm);font-weight:700}
.field-row{display:flex;align-items:stretch;gap:var(--space-2)}
.cascade-selects{display:flex;flex-direction:column;gap:6px;flex:1;min-width:0}
.cascade-selects select{width:100%}
select{width:100%;min-height:44px;padding:0 var(--space-8) 0 var(--space-4);border:1px solid var(--color-border);background:var(--color-surface-2);border-radius:0;appearance:none;background-image:url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2366635c' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right var(--space-4) center}

/* Orientation icon toggles */
.orient-toggle{display:flex;gap:2px;flex-shrink:0}
.orient-btn{width:48px;height:48px;padding:0;border:1px solid oklch(from var(--color-text) l c h / 0.15);background:var(--color-surface-2);border-radius:0;display:grid;place-items:center;transition:all var(--transition-interactive);flex-shrink:0}
.orient-btn:hover{background:var(--color-surface-offset)}
.orient-btn[aria-pressed="true"]{background:color-mix(in oklab,var(--color-primary) 15%,transparent);border-color:var(--color-primary);color:var(--color-primary)}
.icon-portrait{display:block;width:0.55em;height:0.85em;background:currentColor;border-radius:1px}
.icon-landscape{display:block;width:0.85em;height:0.55em;background:currentColor;border-radius:1px}

/* Inner frame position */
.toggle-row{display:flex;gap:var(--space-3);flex-wrap:wrap}
.toggle-btn{min-height:44px;padding:0 var(--space-4);background:var(--color-surface-2);font-size:var(--text-sm);font-weight:700;border:1px solid oklch(from var(--color-text) l c h / 0.12);transition:all var(--transition-interactive)}
.toggle-btn[aria-pressed="true"]{background:var(--color-primary-highlight);color:var(--color-primary)}

/* Compare canvas */
.compare-canvas{padding:var(--space-5);background:var(--color-surface);border:1px solid oklch(from var(--color-text) l c h / 0.1);box-shadow:var(--shadow-sm);border-radius:0;overflow:hidden;position:relative}
.scale-note{font-size:var(--text-xs);color:var(--color-text-muted);margin-bottom:var(--space-4)}
.stage{position:relative;width:100%;min-height:640px;height:min(82vh,760px);padding:var(--space-4);background:linear-gradient(to right,oklch(from var(--color-text) l c h / 0.08) 1px,transparent 1px),linear-gradient(to bottom,oklch(from var(--color-text) l c h / 0.08) 1px,transparent 1px),var(--color-surface-2);background-size:32px 32px,32px 32px,auto;overflow:hidden;border-radius:0}
.stage-empty{position:absolute;inset:0;display:grid;place-items:center;color:var(--color-text-muted);font-size:var(--text-sm)}
.copy-btn {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  min-height: 36px;
  min-width: 36px;
  z-index: 2;
  background: var(--color-surface);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-interactive);
}
.copy-btn.visible {
  opacity: 1;
  pointer-events: auto;
}
.copy-btn.copied { color: var(--color-primary); border-color: var(--color-primary); }

/* Frames */
.frame{position:absolute;border-radius:0;background:none;box-sizing:border-box}
.frame .label-tl,
.frame .label-br {
  position: absolute;
  max-width: calc(100% - 16px);
  padding: 4px 7px;
  font-size: 11px;
  line-height: 1.3;
  background: color-mix(in oklab, currentColor 12%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.label-tl { top: 8px; left: 8px; }
.label-br { bottom: 8px; right: 8px; text-align: right; }
.outer{border:2.5px solid #01696f;color:#01696f}
.inner{border:2.5px dashed #a35b2f;color:#a35b2f}

[data-theme="light"] .outer{border-color:#015a5f;color:#015a5f}
[data-theme="light"] .inner{border-color:#8f4a22;color:#8f4a22}

/* Legend */
.legend{flex-wrap:wrap;gap:var(--space-3);margin-top:var(--space-4)}.legend-item{display:flex;align-items:center;gap:var(--space-2);font-size:var(--text-sm);color:var(--color-text-muted)}.line{width:18px;height:0;border-top:2px solid currentColor}.line.dashed{border-top-style:dashed}

/* Stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.stat-card {
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid oklch(from var(--color-text) l c h / 0.1);
  box-shadow: var(--shadow-sm);
  border-radius: 0;
  display: grid;
  gap: var(--space-2);
  overflow: hidden;
}

/* Catalog */
.section-head{display:flex;align-items:end;justify-content:space-between;gap:var(--space-4);margin:var(--space-12) 0 var(--space-4)}
.section-head h2,.category-head h3{font-size:var(--text-xl)}
.section-head p,.dims,.format-card p,.site-footer{color:var(--color-text-muted)}
.category-block{margin-bottom:var(--space-12)}.category-head{margin:0 0 var(--space-4)}
.catalog{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-4)}
.format-card{
  padding:var(--space-5);
  display:grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap:var(--space-3);
  align-items:start;
  background:var(--color-surface);
  border:1px solid oklch(from var(--color-text) l c h / 0.1);
  box-shadow:var(--shadow-sm);
  border-radius:0
}
.format-card p.description{align-self:start;margin:0}

/* Chips */
.chip {
  display: inline;
  font-size: 0.7rem;
  padding: 2px 5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 0;
  border: 1px solid currentColor;
  line-height: 1;
  vertical-align: middle;
  width: fit-content;
  align-self: start;
}
.chip-subminiature { color: #7c5c9f; background: #f0ebf7; }
.chip-35mm         { color: #01696f; background: #e4f2f1; }
.chip-medium       { color: #a35b2f; background: #f7ede4; }
.chip-large        { color: #2f5fa3; background: #e4ecf7; }
.chip-instant      { color: #7a6e1a; background: #f6f3e0; }

[data-theme="dark"] .chip-subminiature { background: #2a1e38; }
[data-theme="dark"] .chip-35mm         { background: #0e2626; }
[data-theme="dark"] .chip-medium       { background: #2e1a0e; }
[data-theme="dark"] .chip-large        { background: #0e1e36; }
[data-theme="dark"] .chip-instant      { background: #26230a; }

/* Footer */
.site-footer{padding:var(--space-10) 0;border-top:1px solid oklch(from var(--color-text) l c h / 0.12);margin-top:var(--space-12)}

/* Back to top */
.back-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 44px;
  height: 44px;
  border: 1px solid oklch(from var(--color-text) l c h / 0.12);
  background: var(--color-surface);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-interactive), background var(--transition-interactive);
  z-index: 9;
}
.back-top.visible {
  opacity: 1;
  pointer-events: auto;
}
.back-top:hover { background: var(--color-surface-offset); }

/* Responsive */
@media (max-width:960px){.workspace{grid-template-columns:1fr}.catalog{grid-template-columns:1fr 1fr}.stage{height:min(60vh,520px);min-height:520px}}
@media (max-width:640px){.nav{flex-direction:column;align-items:flex-start}.hero-grid,.stats{grid-template-columns:1fr}.catalog{grid-template-columns:1fr 1fr}.stage{height:max(420px,58vh);min-height:420px}.orient-btn{width:42px;height:42px}}
@media (prefers-reduced-motion:reduce){*{scroll-behavior:auto;transition:none!important}}