/* ==========================================================================
   lucus.kim
   ========================================================================== */

:root {
  --bg: #0b0c0e;
  --bg-raised: #131519;
  --bg-hover: #1a1d22;
  --line: #24272e;
  --line-strong: #343842;
  --text: #ecedef;
  --text-dim: #a3a8b3;
  --text-mute: #6d7380;
  --accent: #7ee0b5;
  --accent-ink: #06140e;
  --accent-soft: rgba(126, 224, 181, 0.12);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  --radius: 14px;
  --maxw: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 68px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint dot grid, like a layout canvas */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 0%, transparent 75%);
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; }
p { margin: 0; }
.mono { font-family: var(--mono); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ---------- Clock bar (page-change progress) ---------- */
.clock-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  z-index: 60;
  background: repeating-linear-gradient(90deg, var(--accent) 0 14px, transparent 14px 28px);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
}
.clock-bar.is-running { animation: clock-sweep 0.7s var(--ease) forwards; }
@keyframes clock-sweep {
  0%   { transform: scaleX(0); opacity: 1; }
  70%  { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--gutter);
  background: rgba(11, 12, 14, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }

.brand {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.brand-prompt { color: var(--accent); margin-right: 6px; }
.brand-dot { color: var(--accent); }
.brand-cursor {
  width: 8px; height: 16px;
  margin-left: 3px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav nav { position: relative; }
.nav-links {
  display: flex;
  gap: 4px;
  margin: 0; padding: 0;
  list-style: none;
}
.nav-links a {
  display: block;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.is-active { color: var(--text); }
.nav-indicator {
  position: absolute;
  left: 0; bottom: -2px;
  height: 2px;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: transform 0.45s var(--ease), width 0.45s var(--ease);
}

/* ---------- Pages & transitions ---------- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(32px, 6vw, 72px) var(--gutter) 64px;
}

.page[hidden] { display: none; }
.page { animation: page-in 0.55s var(--ease) both; }
.page.is-leaving { animation: page-out 0.28s ease-in both; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: none; }
}
@keyframes page-out {
  to { opacity: 0; transform: translateY(-10px); filter: blur(3px); }
}

/* Staggered reveal of elements inside the active page */
[data-reveal] { opacity: 0; transform: translateY(16px); }
.page.is-active [data-reveal] {
  animation: reveal 0.7s var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---------- Shared type ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}
h1 {
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 700;
  letter-spacing: -0.04em;
}
.lede {
  margin-top: 22px;
  max-width: 58ch;
  font-size: clamp(16px, 1.6vw, 18px);
  color: var(--text-dim);
}
.lede strong { color: var(--text); font-weight: 600; }
.page-head { margin-bottom: 48px; }
.section-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-mute);
  letter-spacing: 0;
  margin-bottom: 28px;
}

/* ---------- Buttons ---------- */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-mute); background: var(--bg-raised); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- About ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(40px, 6vw, 80px);
  align-items: center;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
  margin: 34px 0 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.facts dt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 2px;
}
.facts dd { margin: 0; font-size: 15px; font-weight: 500; }

.hero-photos {
  position: relative;
  aspect-ratio: 4 / 5;
  max-width: 480px;
  width: 100%;
  justify-self: end;
}
.photo {
  position: absolute;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-raised);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  transition: transform 0.6s var(--ease);
}
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-main {
  top: 0; right: 0;
  width: 68%;
  height: 88%;
  transform: translate3d(var(--px, 0), var(--py, 0), 0);
}
.photo-main img { object-position: 50% 20%; }
.photo-alt {
  left: 0; bottom: 0;
  width: 46%;
  height: 50%;
  transform: translate3d(calc(var(--px, 0) * -1.6), calc(var(--py, 0) * -1.6), 0);
}
.photo-alt img { object-position: 50% 25%; }
.photo-tag {
  position: absolute;
  right: 4%;
  bottom: 3%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-dim);
  background: rgba(19, 21, 25, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.photo-tag .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(126, 224, 181, 0.5); }
  70%  { box-shadow: 0 0 0 8px rgba(126, 224, 181, 0); }
  100% { box-shadow: 0 0 0 0 rgba(126, 224, 181, 0); }
}

.timeline { margin-top: clamp(72px, 10vw, 120px); }
.timeline ol { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.tl-date { font-size: 13px; color: var(--text-mute); padding-top: 3px; }
.timeline h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.01em; }
.timeline p { color: var(--text-dim); max-width: 70ch; }
.timeline em { color: var(--text); font-style: normal; font-weight: 500; }

/* ---------- Skills ---------- */
.waveform {
  margin: 0 0 40px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  overflow: hidden;
}
.waveform svg { width: 100%; height: 130px; display: block; overflow: visible; }
.wf-labels text { fill: var(--text-mute); font-size: 13px; }
.wf-bus text { fill: var(--text-dim); font-size: 12px; text-anchor: middle; }
.trace {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
}
.trace-clk { stroke: var(--accent); }
.trace-valid { stroke: var(--text); }
.trace-data { stroke: var(--text-dim); }
.page.is-active .trace { animation: draw 1.8s var(--ease) forwards 0.35s; }
.page.is-active .trace-valid { animation-delay: 0.55s; }
.page.is-active .trace-data { animation-delay: 0.75s; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.skill-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.skill-card {
  position: relative;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  transition: border-color 0.25s, transform 0.35s var(--ease), background 0.25s;
}
.skill-card:hover { border-color: var(--line-strong); background: var(--bg-hover); transform: translateY(-3px); }
.skill-icon { font-size: 12px; color: var(--accent); margin-bottom: 18px; }
.skill-card h2 { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; }
.skill-card p { margin-top: 8px; color: var(--text-dim); font-size: 15px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}
.chips li {
  padding: 5px 11px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.skill-card:hover .chips li { border-color: #3d424d; }
.chips li:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  padding: 8px 16px;
  font: 500 14px var(--font);
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.filter:hover { color: var(--text); border-color: var(--text-mute); }
.filter.is-active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.project-card {
  display: flex;
  flex-direction: column;
  padding: 28px;
  text-align: left;
  color: inherit;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
  cursor: pointer;
  transition: border-color 0.25s, transform 0.35s var(--ease), background 0.25s, opacity 0.3s;
}
.project-card:hover { border-color: var(--line-strong); background: var(--bg-hover); transform: translateY(-3px); }
.project-card.is-featured { grid-column: 1 / -1; }
.project-card.is-hidden { display: none; }
.project-card.is-entering { animation: reveal 0.5s var(--ease) both; opacity: 0; transform: translateY(12px); }

.pc-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 16px;
}
.pc-lang { color: var(--accent); }
.project-card h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.015em; }
.project-card.is-featured h2 { font-size: clamp(22px, 3vw, 30px); }
.pc-summary { margin-top: 10px; color: var(--text-dim); font-size: 15px; max-width: 70ch; }

.metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 36px;
  margin-top: 22px;
}
.metric-value {
  display: block;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.metric-label { font-family: var(--mono); font-size: 12px; color: var(--text-mute); }

.pc-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 22px;
}
.pc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.pc-badge svg { width: 13px; height: 13px; fill: currentColor; }
.pc-open {
  margin-left: auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color 0.2s, transform 0.3s var(--ease);
}
.project-card:hover .pc-open { color: var(--accent); transform: translateX(3px); }

/* ---------- Project dialog ---------- */
.project-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.8);
}
.project-dialog[open] { animation: dialog-in 0.4s var(--ease); }
.project-dialog.is-closing { animation: dialog-out 0.2s ease-in forwards; }
.project-dialog::backdrop { background: rgba(5, 6, 8, 0.7); backdrop-filter: blur(6px); }
.project-dialog[open]::backdrop { animation: fade 0.3s ease; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }

.dialog-close {
  position: sticky;
  top: 14px;
  float: right;
  margin: 14px 14px 0 0;
  width: 36px; height: 36px;
  font-size: 22px;
  line-height: 1;
  color: var(--text-dim);
  background: var(--bg-hover);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  cursor: pointer;
  z-index: 1;
}
.dialog-close:hover { color: var(--text); }
.dialog-body { padding: 36px clamp(20px, 5vw, 44px) 40px; }
.dialog-body h2 { font-size: clamp(24px, 4vw, 34px); font-weight: 700; padding-right: 30px; }
.dialog-body h3 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-mute);
  margin: 32px 0 14px;
}
.dialog-body ul.details { margin: 0; padding-left: 18px; color: var(--text-dim); }
.dialog-body ul.details li { margin-bottom: 10px; }
.dialog-body ul.details li::marker { color: var(--accent); }

.links-row { display: flex; flex-wrap: wrap; gap: 10px; }
.doc-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 0.2s, background 0.2s;
}
.doc-link:hover { border-color: var(--accent); background: var(--accent-soft); }
.doc-link svg { width: 16px; height: 16px; fill: var(--accent); }
.doc-kind { font-family: var(--mono); font-size: 11px; color: var(--text-mute); }

.results-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.results-table caption { text-align: left; color: var(--text-mute); font-size: 13px; margin-bottom: 10px; }
.results-table th,
.results-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.results-table th { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--text-mute); }
.results-table td:last-child,
.results-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.results-table td:last-child { font-weight: 600; }

.pdf-frame {
  width: 100%;
  height: 460px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.gallery { display: grid; gap: 18px; }
.gallery figure { margin: 0; }
.gallery img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.gallery figcaption { margin-top: 8px; color: var(--text-mute); font-size: 13px; }

/* ---------- Contact ---------- */
.contact { max-width: 760px; }
.contact h1 { font-size: clamp(40px, 7vw, 76px); }
.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 44px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-raised);
}
.contact-label { font-size: 12px; color: var(--text-mute); }
.contact-email {
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  word-break: break-all;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  transition: background-size 0.4s var(--ease);
}
.contact-email:hover { background-size: 100% 2px; }
.copy-btn {
  margin-left: auto;
  padding: 7px 14px;
  font-size: 12px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.copy-btn:hover, .copy-btn.is-copied { color: var(--accent); border-color: var(--accent); }

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.2s, background 0.2s, transform 0.25s var(--ease);
}
.contact-links a:hover { border-color: var(--line-strong); background: var(--bg-raised); transform: translateY(-2px); }
.contact-links svg { width: 17px; height: 17px; fill: var(--text-dim); }

/* ---------- Footer ---------- */
.footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 28px var(--gutter) 36px;
  font-size: 12px;
  color: var(--text-mute);
  border-top: 1px solid var(--line);
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-photos { justify-self: center; max-width: 420px; order: -1; }
  .skill-grid, .project-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 560px) {
  :root { --nav-h: 60px; }
  .brand { font-size: 14px; }
  .brand-prompt, .brand-cursor { display: none; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 8px 9px; font-size: 13px; }
  .facts { grid-template-columns: 1fr 1fr; gap: 14px 18px; }
  .skill-card, .project-card { padding: 22px; }
  .waveform { padding: 16px 14px; }
  .waveform svg { height: 110px; }
  .pdf-frame { display: none; }
  .copy-btn { margin-left: 0; }
}

@media (max-width: 380px) {
  .brand-dot, .brand { letter-spacing: -0.02em; }
  .nav-links a { padding: 8px 6px; font-size: 12.5px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .trace { stroke-dashoffset: 0; }
  .photo-main, .photo-alt { transform: none; }
}
