:root {
  color-scheme: dark;
  --page: #121313;
  --paper: #f4f3ef;
  --muted: rgba(244, 243, 239, 0.64);
  --line: rgba(244, 243, 239, 0.2);
  --accent: #d6ec93;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: Outfit, var(--sans);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }

button { font: inherit; }

.portfolio { min-height: 100dvh; }

.toolbar {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 20px clamp(20px, 3vw, 56px);
  background: linear-gradient(180deg, rgba(18, 19, 19, 0.78), rgba(18, 19, 19, 0));
}

.brand {
  display: grid;
  gap: 3px;
  color: inherit;
  text-decoration: none;
}

.brand__name {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.brand__role,
.text-button,
.page-indicator,
.index-panel p {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.brand__role { color: var(--muted); }

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 0;
  color: var(--paper);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.text-button:hover, .text-button:focus-visible { color: var(--accent); }

.icon-button, .round-button, .close-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--paper);
  background: rgba(18, 19, 19, 0.42);
  cursor: pointer;
}

.icon-button {
  width: 38px;
  height: 38px;
  gap: 4px;
  padding: 10px;
}

.icon-button span { display: block; width: 16px; height: 1px; background: currentColor; }

.icon-button:hover, .icon-button:focus-visible, .round-button:hover, .round-button:focus-visible, .close-button:hover, .close-button:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }

.deck {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100dvh;
  padding: 88px clamp(10px, 3vw, 56px) 84px;
  overflow: hidden;
}

.deck__canvas {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(100%, calc((100dvh - 172px) * 1.77778));
  margin: 0;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #080909;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
}

.deck__canvas img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: slide-in 180ms ease-out;
}

@keyframes slide-in { from { opacity: 0.45; transform: scale(0.996); } to { opacity: 1; transform: scale(1); } }

.deck__tap-zone {
  position: absolute;
  z-index: 2;
  top: 76px;
  bottom: 64px;
  width: 25%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.deck__tap-zone--previous { left: 0; cursor: w-resize; }
.deck__tap-zone--next { right: 0; cursor: e-resize; }
.deck__tap-zone:focus-visible { outline: 1px solid var(--accent); outline-offset: -7px; }

.deck-controls {
  position: fixed;
  z-index: 10;
  bottom: 24px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 16px;
  transform: translateX(-50%);
}

.round-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

.page-indicator { min-width: 58px; text-align: center; color: var(--muted); }

.gallery {
  width: min(100% - 32px, 1440px);
  margin: 0 auto;
  padding: 104px 0 64px;
}

.gallery__page { display: block; width: 100%; height: auto; margin: 0 0 18px; background: #080909; }

.index-panel {
  position: fixed;
  z-index: 30;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100vw);
  padding: 28px;
  overflow-y: auto;
  background: #191a19;
  transform: translateX(102%);
  transition: transform 180ms ease-out;
}

.index-panel.is-open { transform: translateX(0); }

.index-panel__header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.index-panel p { margin: 0 0 6px; color: var(--muted); }
.index-panel h2 { margin: 0; font-family: var(--display); font-size: 32px; line-height: 1; }

.close-button { width: 36px; height: 36px; font-size: 25px; line-height: 1; }

.page-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 24px 0 0; padding: 0; list-style: none; }
.page-list button { display: block; width: 100%; padding: 0; overflow: hidden; border: 1px solid transparent; background: #080909; color: var(--paper); cursor: pointer; text-align: left; }
.page-list button:hover, .page-list button:focus-visible, .page-list button[aria-current="page"] { border-color: var(--accent); outline: none; }
.page-list img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.page-list span { display: block; padding: 9px 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; }

.backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(0, 0, 0, 0.54); }

body.is-gallery { overflow-y: auto; }
body.is-gallery .deck, body.is-gallery .deck-controls { display: none; }

@media (max-width: 640px) {
  .toolbar { min-height: 66px; padding: 16px 18px; }
  .brand__name { font-size: 12px; }
  .brand__role { font-size: 8px; }
  .toolbar__actions { gap: 10px; }
  .toolbar__actions .text-button { display: none; }
  .deck { padding: 72px 0 68px; }
  .deck__canvas { width: 100%; box-shadow: none; }
  .deck__tap-zone { top: 66px; bottom: 52px; width: 22%; }
  .deck-controls { bottom: 13px; gap: 12px; }
  .round-button { width: 34px; height: 34px; }
  .gallery { width: 100%; padding: 70px 0 0; }
  .gallery__page { margin-bottom: 2px; }
  .page-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }
