/* =========================================================
   Halam Kim — design tokens
   Two worlds, one person: the warm wood/brass of a viola,
   and the cool, exact grid of the code she also writes.
   ========================================================= */
:root {
  color-scheme: dark;
  --paper: #14110f;
  --paper-raised: #1e1a17;
  --ink: #ece7dd;
  --ink-soft: #a8a198;
  --wood: #c9826f;      /* viola varnish */
  --wood-deep: #e8cdbd;
  --brass: #c9a666;     /* tailpiece / fittings */
  --slate: #7fb3ab;     /* the DevOps side */
  --rule: rgba(236, 231, 221, 0.14);
  --max: 780px;
  --gutter: 6vw;

  --display: "Cormorant Garamond", Georgia, serif;
  --body: "Work Sans", -apple-system, Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

a { color: var(--wood); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.3em;
}
h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); line-height: 1.05; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.25rem; letter-spacing: 0.01em; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}

/* the "string" rule — the site's recurring signature.
   A single bowed line under headings on music pages. */
.string-rule {
  width: 72px;
  height: 14px;
  margin: 0.6em 0 1.4em;
}
.string-rule path {
  fill: none;
  stroke: var(--wood);
  stroke-width: 1.6;
}

/* ---------- layout shell ---------- */
header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
  gap: 0.8rem;
}
.wordmark {
  font-family: var(--body);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink);
  transition: color 0.2s ease;
}
.wordmark span { color: inherit; }
a.wordmark:hover { color: var(--brass); }
a.wordmark { text-decoration: none; }
a.wordmark:hover { text-decoration: none; }

nav.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
nav.site-nav a { color: var(--ink-soft); }
nav.site-nav a {
  padding-bottom: 0.25rem;
  border-bottom: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
nav.site-nav a:hover { color: var(--wood); text-decoration: none; border-bottom-color: var(--brass); }
nav.site-nav a[aria-current="page"] { color: var(--wood); font-weight: 600; border-bottom-color: var(--wood); }

main { max-width: var(--max); margin: 0 auto; padding: 4.5rem var(--gutter) 5rem; }
main.wide { max-width: 980px; }

section { margin-bottom: 3.5rem; }

footer.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem var(--gutter) 3rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
footer.site-footer .socials a { margin-left: 1rem; color: var(--ink-soft); }

/* ---------- bio / teaching prose ---------- */
.prose p { max-width: 66ch; margin: 0 0 1.1em; }
.prose h3 { margin-top: 1.6em; }

/* ---------- video / gallery grids ---------- */
.video-grid {
  display: grid;
  gap: 2.4rem;
}
.video-card figure { margin: 0; }
.video-card .frame {
  position: relative;
  padding-top: 56.25%;
  background: var(--wood-deep);
  overflow: hidden;
}
.video-card .frame iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.video-card figcaption { margin-top: 0.7rem; }
.video-card figcaption .title { font-family: var(--display); font-size: 1.1rem; }
.video-card figcaption .with { color: var(--ink-soft); font-size: 0.9rem; }

@media (min-width: 640px) {
  .video-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- gallery: masonry keeps each photo's own proportions ---------- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.gallery-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
  background: var(--paper-raised);
}

/* ---------- coding projects: same palette, slate accent ---------- */
.project-card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--slate);
  padding: 1.6rem 1.8rem;
  margin-bottom: 1.6rem;
}
.project-card h3 { font-family: var(--mono); font-size: 1.05rem; margin-bottom: 0.4em; }
.project-card ul { margin: 0.8rem 0; padding-left: 1.1rem; }
.project-card li { margin-bottom: 0.4em; }
.project-card .stack {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--slate);
  margin-top: 0.8rem;
}
.project-card .repo {
  display: inline-block;
  margin-top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--slate);
}

/* ---------- contact ---------- */
.contact-list { max-width: 560px; border-top: 1px solid var(--rule); }
.contact-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  align-items: baseline;
  gap: 1rem;
  padding: 1.3rem 0;
  border-bottom: 1px solid var(--rule);
}
.contact-row .label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
}
.contact-row a {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
  .contact-row { grid-template-columns: 1fr; gap: 0.2rem; }
}

/* =========================================================
   Motion
   ========================================================= */

/* page-to-page: the header holds still while the page cross-fades
   (Chrome, Edge, Safari 18.2+). Other browsers get a simple fade. */
@view-transition { navigation: auto; }
header.site-header { view-transition-name: site-header; }
::view-transition-group(root) { animation-duration: 0.35s; }
::view-transition-group(site-header) { animation-duration: 0.3s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

body { transition: opacity 0.22s ease; }
body.leaving { opacity: 0; }

/* content rises into place when a page loads */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
:is(main > section:not(.hero) > *, .hero-inner > *) {
  animation: rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(2) { animation-delay: 0.06s; }
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(3) { animation-delay: 0.12s; }
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(4) { animation-delay: 0.18s; }
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(5) { animation-delay: 0.24s; }
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(6) { animation-delay: 0.3s; }
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(7) { animation-delay: 0.36s; }
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(8) { animation-delay: 0.42s; }
:is(main > section:not(.hero) > *, .hero-inner > *):nth-child(n+9) { animation-delay: 0.5s; }


/* hover */
.gallery-grid img {
  cursor: zoom-in;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.gallery-grid img:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(32, 29, 26, 0.18);
}
.gallery-grid img:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.project-card { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(32, 29, 26, 0.1);
}

.contact-row { transition: background 0.2s ease, padding-left 0.2s ease; }
.contact-row:hover { background: var(--paper-raised); padding-left: 0.8rem; }

/* photo viewer */
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 29, 26, 0.94);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.lightbox.open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}
.lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease;
}
.lightbox img.swap { opacity: 0; }
.lightbox button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0 0 3px;
  border: 1px solid rgba(238, 236, 229, 0.35);
  border-radius: 50%;
  background: rgba(32, 29, 26, 0.5);
  color: var(--paper);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.lightbox button:hover { background: rgba(238, 236, 229, 0.14); border-color: var(--brass); }
.lb-close { top: 1.2rem; right: 1.2rem; }
.lb-prev  { left: 1.2rem; top: 50%; margin-top: -22px; }
.lb-next  { right: 1.2rem; top: 50%; margin-top: -22px; }
.lb-count {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  color: rgba(238, 236, 229, 0.7);
}

/* =========================================================
   Dark theme + home page
   ========================================================= */
::selection { background: var(--brass); color: #14110f; }

.video-card .frame { background: #0b0908; }
.gallery-grid img:hover { box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55); }
.project-card:hover { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45); }
.lightbox { background: rgba(10, 8, 7, 0.96); }
.lightbox button { color: #ece7dd; background: rgba(10, 8, 7, 0.55); }

main.home { max-width: none; padding: 0 0 3rem; }
.home section { margin-bottom: 0; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 var(--gutter); }

/* full-bleed photo; if assets/home.jpg is missing, the warm glow still looks intentional */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(440px, 76vh, 740px);
  padding: 4rem var(--gutter) 4.5rem;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 78% 18%, rgba(201, 166, 102, 0.22), transparent 62%),
    var(--paper-raised);
}
.hero-inner { max-width: 760px; position: relative; }

/* the photo lives in the top-right corner and dissolves into the dark on its left */
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 58%;
  z-index: -1;
  background:
    url("assets/home.jpg") center 20% / cover no-repeat,
    url("home.jpg") center 20% / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 38%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 38%);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(20, 17, 15, 0) 55%, rgba(20, 17, 15, 0.85) 100%);
}
.hero .eyebrow { display: block; margin-bottom: 0.9rem; }
.hero h1 {
  font-size: clamp(3.4rem, 10vw, 7.2rem);
  letter-spacing: 0.01em;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.5);
}
.hero-sub {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.mission-block { padding: 5rem 0 3rem; }
.mission-block .eyebrow { display: block; margin-bottom: 1rem; }
.mission-block blockquote {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  line-height: 1.35;
  color: var(--wood-deep);
  margin: 0 0 1.6rem;
  padding-left: 1.2rem;
  border-left: 2px solid var(--brass);
  max-width: 28em;
}
.mission-block .mission { max-width: 56ch; font-size: 1.05rem; color: var(--ink-soft); margin: 0; }

.doors { padding: 1.5rem 0 3.5rem; }
.doors-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.door {
  display: flex;
  flex-direction: column;
  padding: 1.8rem 1.6rem;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--ink);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.door:hover {
  text-decoration: none;
  transform: translateY(-4px);
  border-color: var(--brass);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}
.door h3 { font-size: 1.7rem; margin-bottom: 0.5rem; }
.door p { margin: 0 0 1.4rem; color: var(--ink-soft); font-size: 0.95rem; flex: 1; }
.door .go { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--brass); }

@media (max-width: 760px) {
  .doors-grid { grid-template-columns: 1fr; }
  .hero { min-height: 74vh; padding-bottom: 3rem; }
  .hero::before {
    width: 100%;
    -webkit-mask-image: linear-gradient(180deg, #000 35%, transparent 95%);
    mask-image: linear-gradient(180deg, #000 35%, transparent 95%);
  }
}

/* scroll reveal (an animation that ends cleanly, so hover effects keep working) */
.will-reveal { opacity: 0; }
.reveal-in { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d, 0s) backwards; }

/* video projects: thumbnail cards that link out */
.intro { max-width: 56ch; color: var(--ink-soft); margin: 0 0 2.4rem; }
.link-card .thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b0908;
  border: 1px solid var(--rule);
}
.link-card .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.link-card .thumb:hover img { transform: scale(1.05); }
.link-card .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(10, 8, 7, 0.55));
  pointer-events: none;
}
.link-card .play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  padding-left: 3px;
  border: 1px solid rgba(236, 231, 221, 0.6);
  border-radius: 50%;
  background: rgba(10, 8, 7, 0.45);
  color: #ece7dd;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.link-card .thumb:hover .play {
  background: var(--brass);
  border-color: var(--brass);
  color: #14110f;
  transform: scale(1.08);
}
.link-card h3 { margin: 0.9rem 0 0.2rem; font-size: 1.25rem; }
.link-card p { margin: 0 0 0.6rem; color: var(--ink-soft); font-size: 0.92rem; }
.link-card .watch { font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--brass); }
