@import url('theme.css?v=20261111-dark');

/* Layout and motion rules; shared colors and typography live in theme.css. */
:root {
  --object-width: clamp(290px, 30vw, 490px);
  --object-gap: clamp(40px, 5.6vw, 100px);
  --ease: cubic-bezier(.24, .7, .28, 1);
  --soft-motion: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); scrollbar-gutter: stable; scrollbar-color: var(--line) var(--paper); }
body { margin: 0; font: var(--text-body)/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--highlight); outline-offset: 5px; }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
h1 { margin: 0; font-size: var(--text-title); font-weight: 500; letter-spacing: -.055em; line-height: 1.18; }
h2 { margin: 0; font-size: var(--text-heading); font-weight: 500; }

.portfolio-shell { display: flex; flex-direction: column; min-height: 100svh; }
.topbar { height: 82px; flex-shrink: 0; display: flex; align-items: center; padding: 0 var(--gutter); background: var(--header-bg); color: var(--ink); gap: 32px; }
.brand { display: inline-flex; align-items: center; font-weight: 500; }
.brand small { display: block; margin-top: 3px; font: var(--text-small)/1.5 var(--mono); color: var(--muted); }
.main-nav { display: flex; gap: 32px; margin-left: auto; align-items: center; }
.nav-button { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; color: var(--muted); }
.nav-button:hover, .nav-button.is-current { color: var(--ink); }
.nav-button.is-current { text-decoration: underline; text-underline-offset: 8px; }
.header-note { font-size: var(--text-small); color: var(--muted); margin-left: 32px; }
.topbar .brand small, .topbar .header-note { color: var(--secondary); }
.topbar .nav-button { color: var(--muted); }
.topbar .nav-button:hover, .topbar .nav-button.is-current { color: var(--ink); }
.topbar .nav-button.is-current { text-decoration-color: var(--highlight); }
.topbar :focus-visible, .detail-topbar :focus-visible { outline-color: var(--highlight); }
.home { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.project-overview { flex: 0 0 auto; padding: 40px var(--gutter); }
.project-copy { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(32px, 5.6vw, 80px); }
#project-title { outline: none; }
#project-title span, .detail-heading h1 span { color: var(--highlight); }
.project-context { display: grid; justify-items: start; gap: 16px; min-width: 0; }
.project-summary { color: var(--muted); line-height: 1.9; margin: 0; }
.project-tags { display: flex; flex-wrap: wrap; column-gap: 16px; row-gap: 6px; padding: 0; margin: 0; list-style: none; color: var(--muted); font: var(--text-small)/1.6 var(--mono); }
.project-tags li, .project-tags > span { padding: 0; }
.open-project { display: inline-flex; align-items: center; justify-content: space-between; gap: 32px; min-height: 44px; margin-top: 4px; padding: 10px 18px; border-radius: 2px; background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.open-project:hover { background: var(--accent-hover); }
.open-project:active { background: var(--accent); }

.conveyor { position: relative; display: flex; flex: 1 0 320px; flex-direction: column; min-height: 320px; overflow: hidden; padding-top: 20px; }
.conveyor::before { content: ''; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); border-top: 1px solid var(--line); }
.belt-viewport { --selection-left: calc(50% - var(--object-width) / 2); position: relative; flex: 1; min-height: 210px; touch-action: pan-y; }
.belt { display: flex; gap: var(--object-gap); position: relative; left: var(--selection-left); z-index: 2; width: max-content; height: 100%; transform: translate3d(var(--belt-offset, 0px), 0, 0); will-change: transform; }
.work-object { position: relative; display: flex; flex-direction: column; width: var(--object-width); flex: 0 0 var(--object-width); height: 100%; text-align: left; padding: 16px 20px; border: 1px solid transparent; border-radius: 3px; }
.work-object.is-selected { background: var(--surface-raised); border-color: var(--line); }
.object-art { position: relative; display: block; flex: 1; min-height: 0; }
.object-art img { display: block; position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; pointer-events: none; transition: opacity 160ms var(--soft-motion); }
.object-art .object-color { opacity: 0; }
.object-art .object-ghost { opacity: .5; filter: grayscale(1) brightness(1.8); }
.work-object:hover:not(.is-selected) .object-ghost { opacity: .7; }
.work-object.is-selected .object-color { opacity: 1; }
.work-object.is-selected .object-ghost { opacity: 0; }
.object-caption { display: block; padding-top: 10px; color: var(--muted); font-size: var(--text-small); }
.work-object.is-selected .object-caption { color: var(--ink); }
.selection-frame { position: absolute; z-index: 3; left: var(--selection-left); bottom: 0; width: var(--object-width); border-bottom: 3px solid var(--highlight); pointer-events: none; }
.conveyor-bottomline { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; margin: 16px var(--gutter) 0; padding-bottom: 16px; }
.keyboard-hint { margin: 0; color: var(--muted); font-size: var(--text-small); }
.hint-mobile { display: none; }
.belt-navigation { display: flex; gap: 8px; align-items: center; }
.belt-count { font: var(--text-small)/1.5 var(--mono); margin-right: 16px; white-space: nowrap; }
.belt-count i { color: var(--subtle); font-style: normal; padding: 0 4px; }
.belt-arrow { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink); }
.belt-arrow:hover:not(:disabled) { background: var(--surface-raised); }
.belt-arrow:disabled { opacity: .35; }
.footer { margin: 0 var(--gutter); min-height: 44px; border-top: 1px solid var(--line); display: flex; align-items: center; font: var(--text-small)/1.5 var(--mono); color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 20px; top: -100px; z-index: 100; background: var(--ink); color: var(--paper); padding: 12px 18px; }
.skip-link:focus { top: 10px; }
.about-dialog { position: fixed; width: min(600px, calc(100% - 40px)); padding: 40px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); color: var(--ink); }
.about-dialog::backdrop { background: var(--backdrop); }
.close-about { position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; font-size: var(--text-heading); color: var(--muted); }
.close-about:hover { color: var(--ink); }
.about-dialog h2 { margin: 0 44px 24px 0; }
.about-dialog p { margin: 0; line-height: 1.9; color: var(--muted); }
.about-skills { display: flex; flex-wrap: wrap; gap: 16px; margin: 24px 0; color: var(--muted); font: var(--text-small)/1.6 var(--mono); }
.about-return { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px 0; width: 100%; text-align: left; border-top: 1px solid var(--line); }
.about-return:hover { color: var(--muted); }

.transition-layer { position: fixed; z-index: 50; inset: 0; pointer-events: none; visibility: hidden; overflow: hidden; }
.transition-layer.is-active { visibility: visible; }
.transition-veil { position: absolute; inset: 0; background: var(--paper); opacity: 0; }
.transition-object { position: fixed; object-fit: contain; margin: 0; transform-origin: center; will-change: transform; }
.is-shared-visual { visibility: hidden !important; }
body.is-transitioning { overflow: hidden; }
.detail-page:focus { outline: none; }
.detail-page { min-height: 100svh; padding: 0 var(--gutter); }
.detail-topbar { min-height: 82px; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); background: var(--header-bg); color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.detail-topbar .brand small, .detail-topbar .detail-counter { color: var(--secondary); }
.detail-topbar .back-to-work { color: var(--ink); }
.back-to-work { display: inline-flex; gap: 12px; align-items: center; min-height: 44px; padding: 10px 0; color: var(--muted); }
.back-to-work:hover { color: var(--ink); }
kbd { border: 1px solid var(--line); border-radius: 2px; padding: 2px 5px; font: var(--text-small)/1.5 var(--mono); }
.detail-counter { font: var(--text-small)/1.5 var(--mono); color: var(--muted); }
.detail-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 6vw; align-items: center; padding: 48px 0; min-height: 440px; }
.detail-heading { min-width: 0; }
.project-category { margin: 0 0 20px; font: var(--text-small)/1.6 var(--mono); color: var(--muted); }
.detail-lead { margin: 24px 0 0; line-height: 1.9; color: var(--muted); max-width: 35em; }
.detail-tags { margin-top: 20px; }
.detail-visual { min-width: 0; }
.detail-image { display: block; width: 100%; height: clamp(280px, 30vw, 440px); object-fit: contain; }
.detail-body, .detail-exploration { display: grid; grid-template-columns: 1fr 2fr; gap: 6vw; border-top: 1px solid var(--line); padding: 40px 0; }
.detail-prose, .detail-features { min-width: 0; }
.detail-prose > p { margin: 0 0 32px; color: var(--muted); line-height: 1.9; max-width: 40em; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 20px; margin: 0; }
.detail-facts dt { color: var(--muted); font-size: var(--text-small); margin-bottom: 8px; }
.detail-facts dd { margin: 0; }
.detail-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.detail-feature h3 { font-size: var(--text-body); font-weight: 500; margin: 0 0 12px; }
.detail-feature p { margin: 0; color: var(--muted); line-height: 1.9; }
.detail-next { border-top: 1px solid var(--line); padding: 32px 0; }
#detail-next-project { width: 100%; display: flex; align-items: center; gap: 32px; min-height: 44px; padding: 0; text-align: left; }
#detail-next-project > span { font-size: var(--text-small); color: var(--muted); }
#detail-next-project > b { font-size: var(--text-heading); font-weight: 500; }
#detail-next-project > i { font: var(--text-heading)/1.5 var(--sans); margin-left: auto; }
#detail-next-project:hover > b { color: var(--highlight); }
.detail-footer { border-top: 1px solid var(--line); min-height: 64px; display: flex; justify-content: space-between; align-items: center; font: var(--text-small)/1.5 var(--mono); color: var(--muted); }
.detail-footer .back-to-work { font-size: var(--text-small); }
.noscript-note { padding: 16px var(--gutter); }

@media (min-width: 601px) {
  .portfolio-shell { height: 100svh; min-height: 700px; }
  .conveyor { flex: 1 1 320px; justify-content: center; }
  .belt-viewport { max-height: min(410px, calc(var(--object-width) * .95)); }
}
@media (max-width: 1000px) {
  .header-note { display: none; }
  .project-copy { grid-template-columns: .9fr 1.1fr; gap: 32px; }
  .project-summary br { display: none; }
  .detail-features { grid-template-columns: 1fr; gap: 24px; }
  .detail-feature { display: grid; grid-template-columns: 120px 1fr; gap: 20px; }
  .detail-feature h3 { margin: 0; }
}
@media (max-width: 600px) {
  :root { --object-width: min(76vw, 340px); --object-gap: 38px; }
  .topbar { height: 76px; gap: 20px; }
  .main-nav { gap: 24px; }
  .project-overview { padding: 32px var(--gutter); }
  .project-copy { grid-template-columns: 1fr; gap: 24px; }
  .project-context { gap: 14px; }
  .open-project { margin-top: 4px; }
  .conveyor { flex: 1 0 340px; min-height: 340px; padding-top: 16px; }
  .belt-viewport { flex: 0 0 290px; min-height: 250px; }
  .work-object { padding: 12px 16px; }
  .conveyor-bottomline { grid-template-columns: 1fr auto; gap: 12px; margin-top: 16px; padding-bottom: 16px; }
  .hint-desktop { display: none; }
  .hint-mobile { display: inline; }
  .belt-count { margin-right: 4px; }
  .footer { min-height: 44px; }
  .about-dialog { padding: 32px 24px 20px; }
  .detail-topbar { min-height: 76px; gap: 16px; }
  .detail-topbar .brand small, .back-to-work > kbd, .detail-counter { display: none; }
  .detail-hero { grid-template-columns: 1fr; padding: 32px 0; gap: 24px; min-height: 0; }
  .detail-image { height: 280px; }
  .detail-body, .detail-exploration { grid-template-columns: 1fr; gap: 24px; padding: 32px 0; }
  .detail-facts { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .detail-facts > div:last-child { grid-column: 1 / -1; }
  .detail-feature { display: block; }
  .detail-feature h3 { margin-bottom: 8px; }
  .detail-next { padding: 28px 0; }
  #detail-next-project { flex-wrap: wrap; gap: 12px; }
  #detail-next-project > span { flex-basis: 100%; }
}
@media (max-width: 360px) {
  .main-nav { gap: 16px; }
  .keyboard-hint { max-width: 96px; }
  .belt-navigation { gap: 6px; }
  .belt-count { margin-right: 0; }
}
