* { box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }
body { margin: 0; background: var(--stage-950); color: var(--paper-50); }
button, a { font: inherit; }
button { border: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--signal-500); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.small-screen-message { display: none; }

.stage { height: 100%; padding: var(--space-8); display: grid; grid-template-columns: minmax(360px, 30%) minmax(0, 1fr); gap: var(--space-8); }
.identity-card { min-height: 0; padding: var(--space-6); border-radius: var(--radius-md); background: var(--stage-900); display: flex; flex-direction: column; }
.identity-name { margin: 0; font-size: clamp(48px, 5vw, 72px); overflow-wrap: anywhere; }
.identity-pitch { margin: var(--space-6) 0 auto; color: var(--fog-400); }
.identity-links { margin: var(--space-8) 0 0; padding: 0; list-style: none; display: grid; gap: var(--space-4); }
.identity-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2); color: var(--paper-50); text-decoration: none; }
.identity-link svg { width: 20px; height: 20px; align-self: center; }
.placeholder-text { color: var(--fog-400); }
.contact-cta { margin-top: var(--space-6); padding: 10px 14px; display: inline-flex; align-items: center; justify-content: space-between; gap: var(--space-2); border-radius: var(--radius-sm); background: var(--signal-500); color: var(--paper-50); text-decoration: none; }
.contact-cta svg { width: 20px; height: 20px; }

.rail-section { min-width: 0; min-height: 0; position: relative; }
.rail-hint { position: absolute; z-index: 3; top: var(--space-4); left: var(--space-4); margin: 0; padding: var(--space-2); border-radius: var(--radius-sm); background: var(--stage-900); color: var(--fog-400); pointer-events: none; }
.work-rail { height: 100%; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; align-items: stretch; gap: var(--space-6); overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scroll-snap-type: y mandatory; scrollbar-width: none; cursor: grab; user-select: none; }
.work-rail.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.work-rail::-webkit-scrollbar { display: none; }
.work-rail > li { flex: 0 0 min(52vh, 440px); width: 100%; min-width: 0; }
.work-card { position: relative; width: 100%; height: 100%; padding: 0; isolation: isolate; overflow: hidden; border-radius: var(--radius-md); background: var(--work-color); color: var(--paper-50); text-align: left; cursor: pointer; scroll-snap-align: start; transition: transform 160ms ease-out; }
.work-card::before { position: absolute; z-index: 1; inset: 0 auto 0 0; width: 46%; content: ''; background: linear-gradient(90deg, rgba(15, 19, 24, 0.55) 0%, rgba(15, 19, 24, 0.25) 70%, rgba(15, 19, 24, 0) 100%); pointer-events: none; }
.work-card:hover, .work-card:focus-visible { transform: translateY(-8px); }
.work-card-frame { position: absolute; z-index: 2; top: 50%; right: 4%; width: 54%; display: flex; flex-direction: column; overflow: hidden; border-radius: 10px; background: var(--stage-900); box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.08); transform: translateY(-50%); transition: transform 160ms ease-out; }
.work-card-chrome { flex: none; height: 22px; padding: 0 10px; display: flex; align-items: center; gap: 6px; background: var(--stage-800); }
.work-card-chrome i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); }
.work-card-preview { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; margin: 0; object-fit: cover; object-position: center top; }
.work-card:hover .work-card-frame, .work-card:focus-visible .work-card-frame { transform: translateY(-50%) scale(1.02); }
.work-card-content { position: relative; z-index: 2; width: min(42%, 380px); height: 100%; padding: var(--space-6); display: flex; flex-direction: column; justify-content: center; }
.work-card-name { margin: var(--space-2) 0 0; }
.work-card-summary { margin: var(--space-2) 0 0; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }
.work-card-action { margin-top: var(--space-6); color: var(--paper-50); }
.rail-control { position: absolute; top: 50%; z-index: 2; width: 40px; height: 40px; border-radius: var(--radius-sm); transform: translateY(-50%); background: var(--stage-800); color: var(--paper-50); cursor: pointer; }
.rail-control svg, .window-control svg, .live-link svg { width: 20px; height: 20px; }
.rail-control--previous { top: var(--space-2); left: 50%; transform: translateX(-50%); }
.rail-control--next { top: auto; right: auto; bottom: var(--space-2); left: 50%; transform: translateX(-50%); }
.rail-control--previous svg, .rail-control--next svg { transform: rotate(90deg); }
.rail-control:disabled, .rail-control[aria-disabled="true"] { cursor: default; opacity: 0.45; }

.window-layer { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
.case-window.is-minimised { visibility: hidden; }
.case-window { position: absolute; width: min(60vw, 960px); height: min(70vh, 640px); display: flex; flex-direction: column; border-radius: var(--radius-md); box-shadow: var(--shadow-window); overflow: hidden; pointer-events: auto; }
.case-window.is-focused { outline: 2px solid var(--signal-500); }
.window-titlebar { min-height: 64px; padding: var(--space-4) var(--space-6); background: var(--work-color); display: flex; align-items: center; gap: var(--space-2); }
.window-title { margin: 0 auto 0 0; color: var(--paper-50); }
.window-control { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); background: rgba(0, 0, 0, 0.16); color: var(--paper-50); cursor: pointer; }
.window-body { min-height: 0; padding: var(--space-6); overflow-y: auto; background: var(--stage-900); }
.case-summary { margin: var(--space-4) 0 var(--space-6); }
.case-section-title { margin: var(--space-8) 0 var(--space-2); }
.case-section-copy { margin: 0; color: var(--fog-400); }
.case-highlights { margin: var(--space-4) 0 0; padding-left: var(--space-6); color: var(--fog-400); }
.tool-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.tool-pill, .case-tag { display: inline-block; padding: 4px 8px; border-radius: var(--radius-pill); background: var(--stage-800); }
.case-status { margin: var(--space-6) 0 0; color: var(--fog-400); }
.screenshot-placeholder { min-height: 180px; margin-top: var(--space-6); display: grid; place-items: center; background: var(--stage-800); color: var(--fog-400); }
.case-screenshot { width: 100%; margin-top: var(--space-6); display: block; border-radius: var(--radius-sm); background: var(--stage-800); }
.live-link, .not-public { display: inline-flex; align-items: center; gap: var(--space-2); margin-top: var(--space-6); padding: 10px 14px; border-radius: var(--radius-sm); background: var(--signal-500); color: var(--paper-50); text-decoration: none; }
.not-public { background: var(--stage-800); color: var(--fog-400); }

.dock { position: fixed; z-index: 30; bottom: var(--space-6); left: 50%; max-width: calc(100vw - 64px); padding: var(--space-2); display: flex; gap: var(--space-2); overflow-x: auto; border-radius: var(--radius-md); background: var(--stage-800); transform: translateX(-50%); }
.dock-tab { min-width: max-content; padding: 8px 12px; display: inline-flex; align-items: center; gap: var(--space-2); border-radius: var(--radius-pill); background: transparent; color: var(--paper-50); cursor: pointer; }
.dock-tab.is-active { outline: 2px solid var(--signal-500); }
.dock-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--work-color); }
.toast { position: fixed; z-index: 40; bottom: 80px; left: 50%; padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); background: var(--stage-800); color: var(--paper-50); transform: translateX(-50%); }
.stage-error { align-self: center; justify-self: center; }

@media (prefers-reduced-motion: reduce) { .work-card, .work-card-frame { transition: none; } }
@media (max-width: 1099px) {
  html, body { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
  .stage { min-height: 100%; height: auto; padding: var(--space-4); grid-template-columns: 1fr; gap: var(--space-4); }
  .identity-card { min-height: auto; }
  .identity-pitch { margin-bottom: var(--space-6); }
  .rail-section { min-height: 300px; }
  .rail-hint { top: var(--space-2); left: var(--space-2); }
  .work-rail { height: 300px; flex-direction: row; align-items: center; gap: var(--space-4); overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; }
  .work-rail > li { flex: 0 0 min(88vw, 440px); width: auto; height: 300px; }
  .work-card-frame { inset: 0; width: 100%; height: 100%; border-radius: 0; box-shadow: none; transform: none; }
  .work-card:hover .work-card-frame, .work-card:focus-visible .work-card-frame { transform: none; }
  .work-card-chrome { display: none; }
  .work-card-preview { height: 100%; aspect-ratio: auto; }
  .work-card-frame { z-index: 0; }
  .work-card::before { width: 100%; background: linear-gradient(90deg, rgba(15, 19, 24, 0.94) 0%, rgba(15, 19, 24, 0.78) 60%, rgba(15, 19, 24, 0.18) 100%); }
  .work-card-content { width: 68%; background: rgba(15, 19, 24, 0.18); backdrop-filter: blur(12px); }
  .rail-control--previous { top: 50%; left: var(--space-2); transform: translateY(-50%); }
  .rail-control--next { top: 50%; right: var(--space-2); bottom: auto; left: auto; transform: translateY(-50%); }
  .rail-control--previous svg, .rail-control--next svg { transform: none; }
  .case-window { width: 100%; height: 100%; }
  .window-layer { position: fixed; inset: var(--space-2); z-index: 35; }
  .dock { bottom: var(--space-2); max-width: calc(100vw - 32px); }
  .small-screen-message { display: none; }
}

.static-content { grid-column: 1 / -1; max-width: 720px; color: var(--fog-400); }
.static-content a { color: var(--paper-50); }
