:root {
  color-scheme: dark;
  --surface: #000;
  --ink: #fff;
  --quiet: #b8b8b8;
  --edge: #595959;
  --hover: #191919;
  --page-pad: max(40px, env(safe-area-inset-left));
  --header-top: max(28px, env(safe-area-inset-top));
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
}
:root[data-theme="light"] {
  color-scheme: light;
  --surface: #fff;
  --ink: #181818;
  --quiet: #555;
  --edge: #dedede;
  --hover: #f7f7f7;
}
:root[data-theme="red"] {
  color-scheme: light;
  --surface: #ff2b30;
  --ink: #000;
  --quiet: #211010;
  --edge: #791416;
  --hover: #ff565a;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, a { color: inherit; font: inherit; touch-action: manipulation; }
button { cursor: pointer; }
a { text-decoration: none; }
button:focus-visible, a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 5px;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  margin: -1px; padding: 0; border: 0; clip-path: inset(50%); white-space: nowrap;
}
.site-header {
  position: absolute; inset: 0 0 auto; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: var(--header-top) max(40px, env(safe-area-inset-right)) 0 var(--page-pad);
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.brand-toggle {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0; border: 0; background: transparent;
}
.brand-mark, .brand-mark svg { display: block; }
.brand-mark { height: 32px; aspect-ratio: 84/36; }
.brand-mark svg { width: 100%; height: 100%; }
.sign-in {
  min-width: 88px; min-height: 44px; padding: 10px 22px;
  border: 1px solid var(--edge); border-radius: 100px;
  background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 500; line-height: 1.4;
}
.gallery {
  min-height: 100vh; min-height: 100svh; display: grid; place-items: center;
  padding: calc(var(--header-top) + 84px) var(--page-pad) max(88px, env(safe-area-inset-bottom));
}
.project-grid {
  list-style: none; padding: 0; margin: 0; width: min(100%, 840px);
  display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: clamp(36px,7vw,112px);
}
.project-card { min-width: 0; }
.project-link {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; min-width: 0; border-radius: 4px;
}
.project-object {
  position: relative; display: block; isolation: isolate;
  width: min(100%, 340px); aspect-ratio: 1;
}
.project-object > kv-token, .project-object > dp-tag { display: block; width: 100%; height: 100%; }
.project-name {
  margin-top: 8px; font-size: 15px; font-weight: 500; line-height: 1.35;
  letter-spacing: -.025em; text-align: center; text-underline-offset: .32em;
}
.project-detail {
  display: grid; align-content: center; align-items: center;
  grid-template-columns: 1fr 1fr; gap: 12px clamp(32px,7vw,100px);
  max-width: 1050px; min-height: 100svh; margin: 0 auto;
  padding: calc(var(--header-top) + 88px) var(--page-pad) 64px;
}
.back-link { grid-column: 1/-1; min-height: 44px; justify-self: start; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.detail-visual { width: min(100%, 420px); justify-self: center; }
.detail-copy h1 { margin: 0 0 .3em; font-size: clamp(40px,6vw,78px); letter-spacing: -.065em; line-height: 1.03; }
.detail-copy p, .access-dialog p { color: var(--quiet); max-width: 44ch; }
.action-link, .access-list a { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; text-decoration: underline; text-underline-offset: .25em; }
.access-dialog {
  color: var(--ink); background: var(--surface); width: min(410px,calc(100% - 32px));
  max-height: calc(100svh - 32px); overflow: auto; padding: 28px;
  border: 1px solid var(--edge); border-radius: 18px;
}
.access-dialog::backdrop { background: rgb(0 0 0 / .64); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-header h2 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -.055em; }
.close-dialog { display: grid; place-items: center; min-width: 44px; min-height: 44px; border: 0; border-radius: 50%; color: inherit; background: transparent; }
.access-list { list-style: none; margin: 16px 0 0; padding: 0; }
.access-list li { border-top: 1px solid var(--edge); }
.access-list a { width: 100%; padding: 10px 0; }
@media (hover:hover) {
  .sign-in:hover, .close-dialog:hover { background: var(--hover); }
  .project-link:hover .project-name, .back-link:hover { text-decoration: underline; }
}
@media (max-width:600px) {
  :root { --page-pad: max(22px, env(safe-area-inset-left)); --header-top: max(20px, env(safe-area-inset-top)); }
  .site-header { padding-right: max(22px, env(safe-area-inset-right)); }
  .brand-mark { height: 29px; }
  .sign-in { min-width: 80px; padding-inline: 18px; }
  .gallery { padding-top: calc(var(--header-top) + 68px); padding-bottom: max(36px,env(safe-area-inset-bottom)); }
  .project-grid { grid-template-columns: minmax(0,1fr); justify-items: center; gap: clamp(18px,4svh,34px); }
  .project-card { width: min(100%, 68vw, 29svh, 270px); }
  .project-name { margin-top: 3px; }
  .project-detail { grid-template-columns: 1fr; gap: 16px; align-content: start; padding-top: calc(var(--header-top) + 70px); }
  .detail-visual { width: min(100%, 280px); }
  .detail-copy { width: 100%; max-width: 420px; justify-self: center; }
  .access-dialog { padding: 22px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sign-in, .close-dialog { transition: background-color 160ms ease; }
}
@media (forced-colors: active) {
  .brand-mark svg { fill: ButtonText; }
  .sign-in, .access-dialog { border-color: ButtonText; }
  a:focus-visible, button:focus-visible { outline-color: Highlight; }
}
.appearance { margin-top: 16px; border-top: 1px solid var(--edge); font-size: 14px; }
.appearance summary { min-height: 44px; padding: 12px 0; cursor: pointer; }
.appearance fieldset { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; border: 0; padding: 0; }
.appearance button {
  min-height: 44px; padding: 6px 13px; border: 1px solid var(--edge);
  border-radius: 24px; color: var(--ink); background: transparent;
}
.appearance button[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.appearance label { display: flex; align-items: center; min-height: 44px; gap: 8px; margin-top: 6px; cursor: pointer; }
.appearance input { accent-color: var(--ink); width: 18px; height: 18px; margin: 0; }
.appearance :is(summary,input):focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
html[data-motion="paused"] .project-object, html[data-motion="paused"] .project-object * { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .project-object, .project-object * { animation: none !important; }
}
@media (forced-colors: active) {
  .appearance button[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -4px; }
}
