/* ==========================================================================
   Tokens
   ========================================================================== */

:root {
  --paper: #ffffff;
  --ink: #000000;
  --text: #1f1f1f;
  --grey: #6b6b6b;
  --rule: #e8e8e8;
  --rule-strong: #cfcfcf;
  --wash: #f4f4f4;
  --hover: rgba(0, 0, 0, 0.06);
  /* The only colour. Used for the home orb and, sparingly, for "you are here / you are touching this". */
  --orange: #ff5a1f;

  --glass-tint: rgba(255, 255, 255, 0.42);
  --glass-rim: rgba(255, 255, 255, 0.95);
  --glass-rim-soft: rgba(255, 255, 255, 0.3);
  --glass-edge: rgba(0, 0, 0, 0.08);
  --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.06);

  --display: "Archivo", "Pretendard Variable", Pretendard, system-ui, sans-serif;
  --sans: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, "Noto Sans KR", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* One centered column for every page. */
  --column: 50rem;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --radius: 0.5rem;
  --dock-clearance: 112px;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #000000;
  --ink: #ffffff;
  --text: #e2e2e2;
  --grey: #9a9a9a;
  --rule: #242424;
  --rule-strong: #3a3a3a;
  --wash: #141414;
  --hover: rgba(255, 255, 255, 0.1);

  --glass-tint: rgba(24, 24, 24, 0.4);
  --glass-rim: rgba(255, 255, 255, 0.45);
  --glass-rim-soft: rgba(255, 255, 255, 0.1);
  --glass-edge: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.9), 0 2px 6px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

/* Everything is sized in rem, so this one value scales the whole page:
   16px on phones, growing with the viewport to 19.2px (1.2×) at 1728px wide.
   The dock and search panel stay in px so the chrome keeps a fixed size. */
html {
  font-size: clamp(16px, 14.3px + 0.284vw, 19.2px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding-bottom: var(--dock-clearance);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

a { color: inherit; }

img, video { max-width: 100%; height: auto; }

button { font: inherit; color: inherit; }

::selection { background: var(--orange); color: #000; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
  border-radius: 0.25rem;
}

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

.container {
  width: 100%;
  max-width: calc(var(--column) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ==========================================================================
   Liquid glass
   Frosted fallback everywhere; js/liquid-glass.js swaps in real refraction on Chromium.
   ========================================================================== */

.glass {
  --lg-refract: 0.5;
  --lg-depth: 24;
  --lg-blur: 1.5;
  --lg-saturate: 1.6;

  position: relative;
  isolation: isolate;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(0.875rem) saturate(160%);
  backdrop-filter: blur(0.875rem) saturate(160%);
  box-shadow:
    inset 0 0 0 0.5px var(--glass-edge),
    inset 0 1px 1px var(--glass-rim),
    inset 0 -1px 1px var(--glass-rim-soft),
    var(--glass-shadow);
}

/* Specular rim, bright along the top-left and fading around the sides. */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--glass-rim) 0%, transparent 32%, transparent 68%, var(--glass-rim-soft) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

/* Fresnel sheen toward the upper edge. */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--glass-rim-soft), transparent 50%);
  pointer-events: none;
}

/* ==========================================================================
   Dock (primary navigation)
   ========================================================================== */

.dock {
  --lg-refract: 0.55;
  --lg-depth: 20;
  --lg-blur: 2.5;
  --glass-tint: color-mix(in srgb, var(--paper) 62%, transparent);

  position: fixed;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  max-width: calc(100vw - 24px);
  height: 56px;
  margin-inline: auto;
  padding: 6px;
  border-radius: 999px;
}

.dock-link {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 17px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s;
}

.dock-link:hover { background: var(--hover); }

.dock-link.is-active { background: var(--ink); color: var(--paper); }

.dock-sep {
  width: 1px;
  height: 22px;
  margin-inline: 6px;
  background: var(--glass-edge);
}

.dock-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.2s;
}

.dock-icon:hover { background: var(--hover); }

.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

@media (max-width: 440px) {
  .dock { height: 54px; padding: 5px; }
  .dock-link { height: 44px; padding: 0 12px; font-size: 14px; }
  .dock-icon { width: 40px; }
  .dock-sep { margin-inline: 3px; }
}

/* ==========================================================================
   Page heads
   ========================================================================== */

.page-head { padding-block: clamp(2.5rem, 8vh, 4.5rem) 2rem; }

.page-title {
  margin: 0;
  font-size: clamp(1.875rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.025em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.875rem;
  margin: 0.75rem 0 0;
  color: var(--grey);
  font-size: 0.9375rem;
}

.page-meta a { color: var(--grey); text-decoration: none; }
.page-meta a:hover { color: var(--ink); }

.empty { color: var(--grey); }

/* ==========================================================================
   Home: one screen. Black-and-white type on the left; the only colour on the
   site is the orange orb on the right, seen through a liquid glass card.
   ========================================================================== */

.home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 3rem;
  min-height: calc(100vh - var(--dock-clearance));
  min-height: calc(100svh - var(--dock-clearance));
  padding-block: 2.5rem;
}

.home-greet {
  min-height: 1.6em;
  margin: 0 0 0.75rem;
  color: var(--grey);
  font-size: 1rem;
}

.home .typed-cursor { color: var(--orange); font-weight: 700; }

.home-name {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 6.4vw, 4.5rem);
  font-stretch: 125%;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.home-name span { display: block; }

.home-lede {
  margin: 1.5rem 0 0;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.5;
}

.home-lede a,
.home-now a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness 0.15s;
}

.home-lede a:hover,
.home-now a:hover { text-decoration-thickness: 4px; }

.home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.5rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 1rem;
}

.home-links a { text-decoration: none; }

.home-links a:hover {
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

.home-stage {
  position: relative;
  justify-self: end;
  width: 100%;
  max-width: 26rem;
  aspect-ratio: 1;
}

.home-orb {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: var(--orange);
  translate: var(--ox, 0) var(--oy, 0);
  transition: translate 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: orb-rise 1s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes orb-rise {
  from { opacity: 0; scale: 0.7; }
}

/* Straddles the orb's lower-left rim so the lens bends the edge between orange and paper. */
.home-now {
  --lg-refract: 0.9;
  --lg-depth: 26;
  --lg-blur: 1.2;
  --glass-tint: color-mix(in srgb, var(--paper) 28%, transparent);

  position: absolute;
  left: 0;
  bottom: 12%;
  width: 74%;
  padding: 1.125rem 1.375rem 1.25rem;
  border-radius: 1.75rem;
}

.home-now-label { margin: 0; color: var(--text); font-size: 0.8125rem; opacity: 0.75; }

.home-now-role {
  margin: 0.25rem 0 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: keep-all;
}

@media (max-width: 760px) {
  .home {
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 2.5rem;
  }
  .home-stage { justify-self: center; max-width: 16rem; }
  .home-now { left: -18%; width: 88%; }
}

/* ==========================================================================
   Posts
   ========================================================================== */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.chip {
  height: 2.125rem;
  padding: 0 0.9375rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.chip:hover { border-color: var(--ink); }

.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.post-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}

.post-row-title {
  flex: 1 1 20em;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.post-row:hover .post-row-title {
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.post-row time {
  color: var(--grey);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pagination {
  display: flex;
  justify-content: space-between;
  margin-top: 1.75rem;
  font-size: 1rem;
}

.pagination a { text-underline-offset: 0.2em; }

/* ==========================================================================
   Work
   ========================================================================== */

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem 1.5rem;
}

@media (max-width: 560px) {
  .cards { grid-template-columns: minmax(0, 1fr); }
}

.card { display: block; color: var(--ink); text-decoration: none; }

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--wash);
}

.card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-year {
  --lg-refract: 0.7;
  --lg-depth: 14;
  --lg-blur: 1;
  --glass-tint: color-mix(in srgb, var(--paper) 50%, transparent);

  position: absolute;
  top: 0.625rem;
  left: 0.625rem;
  display: inline-flex;
  align-items: center;
  height: 1.75rem;
  padding: 0 0.6875rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-title {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.card:hover .card-title {
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.card-authors { margin: 0; color: var(--grey); font-size: 0.875rem; line-height: 1.5; }
.card-authors strong { color: var(--ink); font-weight: 500; }

.card-venue { margin: 2px 0 0; font-size: 0.875rem; }

/* ==========================================================================
   Prose (posts, about, project pages)
   ========================================================================== */

.prose {
  color: var(--text);
  font-size: 1.0625rem;
  line-height: 1.75;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.prose > :first-child { margin-top: 0; }

.prose p { margin: 0 0 1.15em; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.prose h1 { margin: 1.9em 0 0.7em; font-size: 1.75rem; }
.prose h2 { margin: 1.8em 0 0.6em; font-size: 1.5rem; }
.prose h3 { margin: 1.6em 0 0.5em; font-size: 1.25rem; }
.prose h4 { margin: 1.5em 0 0.5em; font-size: 1.0625rem; }
.prose h5, .prose h6 { margin: 1.4em 0 0.4em; font-size: 1rem; }

.prose a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color 0.2s;
}

.prose a:hover { text-decoration-color: var(--orange); text-decoration-thickness: 2px; }

.prose strong { color: var(--ink); font-weight: 650; }
.prose del { color: var(--grey); }

.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.prose li { margin: 0.3em 0; }
.prose li > ul, .prose li > ol { margin-bottom: 0; }
.prose li p { margin-bottom: 0; }
.prose li::marker { color: var(--grey); }

.prose blockquote {
  margin: 1.5em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 2px solid var(--ink);
  color: var(--grey);
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose hr { height: 1px; margin: 2.5em 0; border: 0; background: var(--rule); }

.prose img,
.prose video {
  display: block;
  margin: 1.5em auto;
  border-radius: var(--radius);
}

.prose iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 1.5em 0;
  border: 0;
  border-radius: var(--radius);
}

.prose figure { margin: 2em 0; }
.prose figure img { margin: 0 auto; }

.prose figcaption {
  max-width: 85%;
  margin: 0.625rem auto 0;
  color: var(--grey);
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: center;
}

.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 1.5em 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose th, .prose td { padding: 0.5em 0.9em; border-bottom: 1px solid var(--rule); text-align: left; }
.prose th { font-weight: 600; border-bottom-color: var(--ink); }

.prose :not(pre) > code {
  padding: 0.12em 0.38em;
  border-radius: 0.3125rem;
  background: var(--wash);
  font-family: var(--mono);
  font-size: 0.86em;
}

.prose mark { background: var(--ink); color: var(--paper); padding: 0 0.2em; }

.prose .katex-display { overflow-x: auto; overflow-y: hidden; padding-block: 0.3em; }

/* Utility classes used inside markdown content. */
.prose .text-center { text-align: center; }
.prose .text-center img,
.prose .text-center video { margin-inline: auto; }
.prose .mb-4 { margin-bottom: 1.5rem; }

.comments {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 2.75rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
}

/* ==========================================================================
   Code blocks (token colours live in prism.css)
   ========================================================================== */

.code-copy {
  --lg-depth: 10;
  --lg-refract: 0.4;
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  height: 1.75rem;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

pre:hover .code-copy,
.code-copy:focus-visible { opacity: 1; }

@media (hover: none) {
  .code-copy { opacity: 1; }
}

/* ==========================================================================
   Search
   ========================================================================== */

.search {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14vh 16px 16px;
}

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  animation: fade-in 0.2s ease;
}

.search-panel {
  --lg-blur: 6;
  --lg-depth: 28;
  --glass-tint: color-mix(in srgb, var(--paper) 64%, transparent);
  width: 100%;
  max-width: 620px;
  overflow: hidden;
  border-radius: 26px;
  animation: pop-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid var(--glass-edge);
  color: var(--grey);
}

#search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
}

#search-input::placeholder { color: var(--grey); }

.search-field kbd {
  padding: 2px 7px;
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
}

.search-results { max-height: 55vh; overflow-y: auto; padding: 8px; }

.search-hint { padding: 28px 16px; color: var(--grey); font-size: 15px; text-align: center; }

.search-result {
  display: block;
  padding: 10px 12px;
  border-radius: 16px;
  color: var(--ink);
  text-decoration: none;
}

.search-result:hover,
.search-result:focus-visible { background: var(--hover); outline: none; }

.search-result-title { font-size: 16px; font-weight: 600; }

.search-result-snippet {
  display: -webkit-box;
  overflow: hidden;
  color: var(--grey);
  font-size: 14px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-snippet mark { background: var(--orange); color: #000; border-radius: 3px; padding: 0 2px; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  margin-top: 5rem;
  font-size: 0.875rem;
}

.site-footer::before {
  content: "";
  flex-basis: 100%;
  height: 1px;
  margin-bottom: 0.75rem;
  background: var(--rule);
}

.footer-copy { margin: 0; color: var(--grey); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a { color: var(--grey); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }

/* SVG filter host: must stay rendered (not display:none) for url(#…) to resolve. */
.glass-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
