:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --text: #18181b;
  --text-2: #52525b;
  --muted: #71717a;
  --faint: #a1a1aa;
  --dot: #d4d4d8;
  --dot-group: #b4b4ba;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 12px 32px rgba(0, 0, 0, .07);
  --header-h: 56px;
  --footer-h: 44px;
  --pad-y: 20px;
  --pad-x: 72px;
  --radius: 6px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }

/* ---------- Top bar ---------- */
.topbar {
  flex: 0 0 var(--header-h);
  height: var(--header-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 10;
}

.projects {
  grid-column: 2;
  display: flex;
  align-items: stretch;
  height: var(--header-h);
  gap: 4px;
}

.proj {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s ease;
  border-radius: 0;
}
.proj .t { font-weight: 500; font-size: 14px; letter-spacing: -0.01em; }
.proj .s { font-size: 12px; color: var(--faint); transition: color .15s ease; }
.proj::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .2s ease;
}
.proj:hover { color: var(--text-2); }
.proj[aria-current="true"] { color: var(--text); }
.proj[aria-current="true"] .s { color: var(--muted); }
.proj[aria-current="true"]::after { transform: scaleX(1); }

@keyframes proj-enter {
  0%   { background: transparent; }
  30%  { background: #f4f4f5; }
  100% { background: transparent; }
}
.proj.enter { animation: proj-enter .7s ease; }

/* mobile dropdown (hidden on desktop) */
.dropdown { display: none; position: relative; grid-column: 2; justify-self: center; }
.dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 500;
  color: var(--text);
  max-width: 52vw;
}
.dropdown-btn svg { color: var(--faint); flex: none; }
.dropdown-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: none;
}
.dropdown[data-open="true"] .dropdown-menu { display: block; }
.dropdown-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 6px;
  text-align: left;
  color: var(--text-2);
}
.dropdown-item .t { font-weight: 500; color: var(--text); }
.dropdown-item .s { font-size: 12px; color: var(--muted); }
.dropdown-item:hover { background: var(--bg); }
.dropdown-item[aria-selected="true"] { background: var(--bg); }

.actions {
  grid-column: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}

.counter {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  margin-right: 6px;
  white-space: nowrap;
}
.counter .sep { margin: 0 4px; color: var(--dot); }
.counter #cur { color: var(--text); font-weight: 500; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--line-strong); background: #fafafa; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  transition: border-color .15s ease, color .15s ease;
}
.btn-icon:hover { border-color: var(--line-strong); color: var(--text); }
.btn-icon[hidden] { display: none; }

/* ---------- Stage ---------- */
.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.slide {
  position: absolute;
  inset: var(--pad-y) var(--pad-x);
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 16:9 frame sized to whatever is smaller: the stage width or the stage height */
.slide-frame {
  position: relative;
  width: min(100%, calc((100dvh - var(--header-h) - var(--footer-h) - 2 * var(--pad-y)) * 16 / 9));
  aspect-ratio: 16 / 9;
}

.slide img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: slide-in .18s ease;
}
@keyframes slide-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.slide img.swap { animation: none; }

/* clickable link areas laid over the image (positions in % of the frame) */
.hotspots { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute;
  display: block;
  pointer-events: auto;
  border-radius: 3px;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.hotspot:hover, .hotspot:focus-visible {
  background: rgba(24, 24, 27, .06);
  box-shadow: 0 0 0 4px rgba(24, 24, 27, .06);
  outline: none;
}

.arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--faint);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: color .15s ease, border-color .15s ease, transform .15s ease;
  z-index: 2;
}
.arrow:hover { color: var(--text); border-color: var(--line-strong); }
.arrow:active { transform: translateY(-50%) scale(.96); }
.arrow[disabled] { opacity: .3; cursor: default; pointer-events: none; }
.arrow.prev { left: 14px; }
.arrow.next { right: 14px; }

/* ---------- Pager ---------- */
.pager {
  flex: 0 0 var(--footer-h);
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dots {
  display: flex;
  align-items: center;
  justify-content: center;
}
.dot-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
}
.dot-group + .dot-group { border-left: 1px solid var(--line); }
.dot {
  position: relative;
  width: 8px;
  height: 20px;
  transition: width .2s ease;
}
.dot::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 3px;
  background: var(--dot);
  transition: background .15s ease;
}
.dot:hover::after { background: var(--faint); }
.dot-group.on .dot::after { background: var(--dot-group); }
.dot[aria-current="true"] { width: 20px; }
.dot[aria-current="true"]::after { background: var(--text); }

.progress {
  display: none;
  width: min(60vw, 240px);
  height: 2px;
  background: var(--line);
  border-radius: 1px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: var(--text);
  transition: width .2s ease;
}

/* ---------- Fullscreen ---------- */
:fullscreen body, body:fullscreen { background: var(--bg); }
.is-fullscreen .topbar,
.is-fullscreen .pager { display: none; }
.is-fullscreen { --header-h: 0px; --footer-h: 0px; --pad-y: 24px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .proj .s { display: none; }
  .proj { padding: 0 10px; }
}

@media (max-width: 900px) {
  .projects { display: none; }
  .dropdown { display: block; }
}

@media (max-width: 720px) {
  :root { --header-h: 52px; --footer-h: 36px; --pad-y: 10px; --pad-x: 12px; }
  .topbar { padding: 0 12px; grid-template-columns: 1fr auto; gap: 8px; }
  .dropdown { grid-column: 1; justify-self: start; }
  .actions { grid-column: 2; }
  .dropdown-btn { max-width: 100%; }
  .dropdown-menu { left: 0; transform: none; }
  .dropdown-btn { height: 32px; font-size: 13px; }
  .counter { font-size: 12px; margin-right: 2px; }
  .btn { height: 32px; padding: 0 10px; }
  .btn span { display: none; }
  .btn-icon { display: none; }
  .slide img { border-radius: 4px; }
  .arrow { width: 34px; height: 34px; background: rgba(255, 255, 255, .85); backdrop-filter: blur(6px); }
  .arrow.prev { left: 6px; }
  .arrow.next { right: 6px; }
  .dots { display: none; }
  .progress { display: block; }
}

@media (max-height: 480px) {
  :root { --header-h: 48px; --footer-h: 28px; --pad-y: 8px; --pad-x: 60px; }
}
