:root {
  --bg: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6a65;
  --rule: #e4e1da;
  --accent: #1f4e8c;
  --accent-soft: rgba(31, 78, 140, 0.08);

  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

:root[data-theme="dark"] {
  --bg: #141413;
  --text: #e8e6e1;
  --muted: #9a978f;
  --rule: #2c2b28;
  --accent: #8db4ea;
  --accent-soft: rgba(141, 180, 234, 0.1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: clip; /* the sticky bar's full-width background must not add a sideways scrollbar */
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 16px 48px;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- header ---------- */
.intro {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--rule);
}

.name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.4rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}

.name-ko {
  font-family: "Noto Serif KR", var(--serif);
  font-weight: 400;
  font-size: 0.45em;
  color: var(--muted);
  margin-left: 4px;
  letter-spacing: 0;
  white-space: nowrap;
}

.tagline {
  color: var(--muted);
  margin: 6px 0 0;
}

.places {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.places .sep {
  width: 18px;
  height: 1px;
  background: var(--rule);
}

/* ---------- dark mode button (top right) ---------- */
.theme {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  cursor: pointer;
}
.theme:hover { color: var(--text); }
.theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* half-filled circle: sun/moon without an icon font */
.theme-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
  transition: transform 0.3s ease;
}
:root[data-theme="dark"] .theme-dot { transform: rotate(180deg); }

.socials, .tabs {
  font-family: var(--mono);
  font-size: 0.9rem;
}

.socials { margin: 0 0 16px; }
.socials span { color: var(--muted); margin: 0 6px; }
/* dotted underline + arrow: these links leave the page */
.socials a, .doc-link {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.socials a:hover, .doc-link:hover { text-decoration-style: solid; }
.socials a[target="_blank"]::after, .doc-link::after {
  content: "\2197"; /* ↗ */
  display: inline-block;
  margin-left: 2px;
  font-size: 0.8em;
  text-decoration: none;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.tabs a { color: var(--muted); padding: 2px 0; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); }

/* ---------- sticky bar: tabs + pool line; name shows once the header is gone ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 20px;
  padding: 12px 0 8px;
}
/* the bar's background spans the whole window, so nothing scrolling underneath peeks out at the sides */
.bar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  background: var(--bg);
  z-index: -1;
}
/* once pinned, a full-width hairline stands in for the pool line, which scrolls away with the page */
.bar.scrolled::before { box-shadow: 0 1px 0 var(--rule); }
.bar-name {
  display: none;
  margin-right: auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text);
}
.bar.scrolled .bar-name { display: block; animation: fade 0.25s ease; }

/* ---------- pool shot divider (animated in script.js) ---------- */
.cue-line {
  position: relative;
  height: 14px;
  margin-bottom: 30px;
}
.cue-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--rule);
}
.cue-line span {
  position: absolute;
  top: 50%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cue-line .cue-stick {
  left: 0;
  width: calc(12% - 7px);
  height: 3px;
  border-radius: 2px;
  transform: translate(0, -50%);
  background: linear-gradient(to right, #4a2f1d 0 30%, #c9a36a 30% calc(100% - 3px), #efece4 calc(100% - 3px));
}
.cue-ball {
  left: 12%;
  width: 8px;
  height: 8px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--muted);
}
.eight-ball {
  left: 70%;
  width: 8px;
  height: 8px;
  background: var(--text);
}
.pocket {
  left: calc(100% - 6px);
  width: 12px;
  height: 12px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1.5px var(--muted);
}
.cue-line .pocket { z-index: 0; }
.cue-line .cue-ball, .cue-line .eight-ball { z-index: 1; }

/* small off-centre marks so you can see the balls roll and spin */
.cue-ball::after, .eight-ball::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}
.cue-ball::after { width: 2px; height: 2px; top: 1px; left: 3px; background: #c0392b; }
.eight-ball::after { width: 3px; height: 3px; top: 1px; left: 2.5px; background: #ffffff; }
.cue-line .cue-stick { z-index: 2; }

/* ---------- panels ---------- */
/* Without JS every section shows; with JS only the active one does. */
.js .panel { display: none; }
.js .panel.active { display: block; animation: fade 0.25s ease; }
.panel + .panel { margin-top: 48px; }
.js .panel + .panel { margin-top: 0; }

@keyframes fade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
  margin: 0 0 20px;
}

h3 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 40px 0 16px;
}

p { margin: 0 0 16px; }

.muted { color: var(--muted); font-size: 0.92rem; }

/* ---------- entries ---------- */
.entry {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}
.entry:last-child { border-bottom: none; }

.entry-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 2px 16px;
}

.org { font-weight: 500; }

.date {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.role {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 2px 0 8px;
}

.entry ul {
  margin: 0;
  padding-left: 18px;
}
.entry li { margin-bottom: 6px; }
.entry li::marker { color: var(--muted); }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { margin-bottom: 8px; }

/* ---------- contact ---------- */
.contact-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 16px;
  overflow-wrap: anywhere;
}
.label {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  width: 80px;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ---------- footer ---------- */
.foot {
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

/* the fixed button would sit on top of the sticky bar on narrower screens, so let it scroll away */
@media (max-width: 900px) {
  .theme { position: absolute; }
}

@media (max-width: 480px) {
  .wrap { padding-top: 72px; }
  .intro { flex-direction: column; align-items: flex-start; gap: 16px; }
  .avatar { width: 96px; height: 96px; }
  .name { font-size: 2rem; }
}

/* ---------- contributions: video cards + journal shelf ---------- */
#contributions h2 + h3 { margin-top: 0; }
#contributions h3 { display: flex; align-items: center; gap: 8px; }
.h-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
}
.h-icon .fill { fill: currentColor; stroke: none; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.media, .cover {
  display: flex;
  flex-direction: column;
  color: var(--text);
}
.media:hover, .cover:hover { text-decoration: none; }

.media {
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.media:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.35);
}

.thumb-wrap {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--rule);
}
.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.media:hover .thumb-wrap img { transform: scale(1.04); }

/* play button for thumbnails that don't have one baked in */
.play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(20, 20, 19, 0.7);
  transition: background 0.2s ease, transform 0.2s ease;
}
.play::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 16px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #ffffff;
}
.media:hover .play { background: #e62117; transform: translate(-50%, -50%) scale(1.08); }

.media-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 16px;
}

.media-src, .cover-issue {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.src-badge {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  color: #ffffff;
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1;
}
.src-badge.li { background: #0a66c2; }
.src-badge.yt { background: #e62117; border-radius: 4px; }
.src-badge.yt::after {
  content: "";
  border-style: solid;
  border-width: 3.5px 0 3.5px 6px;
  border-color: transparent transparent transparent #ffffff;
  margin-left: 1px;
}

.media-title, .cover-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.25;
}
.media:hover .media-title, .cover:hover .cover-title { color: var(--accent); }

.media-desc, .cover-desc {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* journal covers standing on a shelf */
.shelf {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  position: relative;
}
.cover { gap: 4px; }
.cover img {
  width: 100%;
  height: auto;
  aspect-ratio: 595 / 841;
  object-fit: cover;
  border-radius: 3px 6px 6px 3px;
  margin-bottom: 12px;
  /* a bit of spine and depth so they read as printed issues */
  box-shadow:
    inset 4px 0 0 rgba(0, 0, 0, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.15),
    0 12px 24px -12px rgba(0, 0, 0, 0.45);
  transform-origin: bottom center;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.cover:hover img {
  transform: translateY(-6px) rotate(-1.5deg);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.15),
    0 20px 32px -14px rgba(0, 0, 0, 0.5);
}

@media (max-width: 560px) {
  .media-grid { grid-template-columns: 1fr; }
  .shelf { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .media, .thumb-wrap img, .play, .cover img { transition: none; }
}
