/* ============================================================
   Nicholas Kim — editorial / mono portfolio
   ============================================================ */

:root {
  /* eDEX-style terminal HUD (default) */
  --bg: #06100c;
  --bg-2: #0a1712;
  --panel: #091410;
  --ink: #d3f7e4;
  --muted: #5fa085;
  --accent: #2fe6a4;
  --accent-2: #28d6e6;
  --line: rgba(47, 230, 164, 0.22);
  --hover: #2fe6a4;
  --hover-ink: #04130d;
  --grid: rgba(47, 230, 164, 0.05);
  --glow: 0 0 6px rgba(47, 230, 164, 0.45);
  --glow-strong: 0 0 16px rgba(47, 230, 164, 0.5);
  --scan: 0.5;
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "Space Mono", ui-monospace, Menlo, monospace;
  --pad: clamp(20px, 5vw, 80px);
}

/* Toggle alternate: clean editorial / cream (the contrast button) */
[data-contrast="dark"] {
  --bg: #e7e4dd;
  --bg-2: #dedbd2;
  --panel: #e7e4dd;
  --ink: #15130f;
  --muted: #6b6557;
  --accent: #15130f;
  --accent-2: #6b6557;
  --line: rgba(21, 19, 15, 0.16);
  --hover: #15130f;
  --hover-ink: #e7e4dd;
  --grid: transparent;
  --glow: none;
  --glow-strong: none;
  --scan: 0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease;
}

/* CRT scanlines overlay (terminal theme; --scan is 0 in editorial) */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  opacity: var(--scan);
  background: repeating-linear-gradient(
    0deg, rgba(0, 0, 0, 0.25) 0, rgba(0, 0, 0, 0.25) 1px, transparent 1px, transparent 3px
  );
  animation: flicker 5s infinite steps(40);
}
@keyframes flicker { 0%, 96%, 100% { opacity: var(--scan); } 97% { opacity: calc(var(--scan) * 0.7); } 98% { opacity: var(--scan); } }

::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }
em { font-style: italic; }

/* ---------- Grain ---------- */
.grain {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.grain { mix-blend-mode: screen; opacity: 0.06; }
[data-contrast="dark"] .grain { mix-blend-mode: multiply; opacity: 0.05; }

/* ---------- Custom cursor ---------- */
.cursor {
  position: fixed; top: 0; left: 0; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink); z-index: 9999; pointer-events: none;
  transform: translate(-50%, -50%); transition: width 0.2s, height 0.2s, background 0.2s;
  mix-blend-mode: difference; will-change: transform;
}
.cursor.big { width: 46px; height: 46px; background: #fff; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--pad); mix-blend-mode: difference; color: #c9c6bf;
}
.nav a, .nav button { color: #c9c6bf; }
.nav__brand { font-family: var(--mono); font-weight: 700; font-size: 0.95rem; letter-spacing: -0.02em; }
.nav__brand .reg { font-size: 0.6rem; vertical-align: super; margin-left: 1px; }
.nav__menu { display: flex; gap: 30px; }
.nav__menu a { font-size: 0.82rem; position: relative; }
.nav__menu a span { opacity: 0.5; font-size: 0.7rem; margin-right: 2px; }
.nav__menu a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 1px; width: 0;
  background: currentColor; transition: width 0.3s ease;
}
.nav__menu a:hover::after { width: 100%; }
.nav__contrast {
  display: inline-flex; align-items: center; gap: 8px; background: none; border: none;
  font-family: var(--mono); font-size: 0.78rem; cursor: pointer; color: inherit;
}
.nav__contrast .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: linear-gradient(90deg, #fff 50%, #000 50%); border: 1px solid currentColor;
}
.nav__resume { border: 1px solid currentColor; border-radius: 30px; padding: 4px 13px; }
.nav__resume::after { display: none !important; }
.nav__toggle {
  display: none; align-items: center; gap: 8px; background: none; border: none;
  color: inherit; font-family: var(--mono); font-size: 0.8rem; cursor: pointer;
  letter-spacing: 0.04em; text-transform: uppercase;
}

/* ---------- Mobile menu ---------- */
.mobile-menu {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  padding: var(--pad);
  transform: translateY(-100%); visibility: hidden;
  transition: transform 0.45s cubic-bezier(0.7, 0, 0.2, 1), visibility 0.45s;
}
.mobile-menu.is-open { transform: none; visibility: visible; }
.mobile-menu a {
  font-family: var(--display); font-weight: 500; text-transform: uppercase;
  font-size: clamp(2rem, 11vw, 3.4rem); letter-spacing: -0.02em; line-height: 1.12;
  display: flex; align-items: baseline; gap: 14px;
}
.mobile-menu a span { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); font-weight: 400; }
.mobile-menu__resume { font-size: clamp(1.3rem, 6vw, 1.9rem) !important; color: var(--muted); margin-top: 24px; }
body.menu-open { overflow: hidden; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between;
  padding: 120px var(--pad) 40px;
}
.hero__top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  font-size: 0.78rem; color: var(--muted); flex-wrap: wrap;
}
.bin { letter-spacing: 0.1em; }
.hero__avail { display: inline-flex; align-items: center; gap: 9px; }
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: #2ecc71;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.6); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.hero__title {
  font-family: var(--display); font-weight: 500;
  font-size: clamp(3.4rem, 16vw, 15rem); line-height: 0.86;
  letter-spacing: -0.04em; margin: auto 0;
  text-transform: uppercase;
}
.hero__title .line { display: block; }
.hero__title .line:nth-child(2) { padding-left: 0.5em; }
.star {
  display: inline-block; font-size: 0.7em; vertical-align: 0.08em;
  margin-right: 0.12em; animation: spin 8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero__bottom {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; flex-wrap: wrap;
}
.hero__tag { max-width: 46ch; font-size: 0.92rem; line-height: 1.6; }
.hero__meta { text-align: right; font-size: 0.8rem; color: var(--muted); display: grid; gap: 8px; }
.clock { font-variant-numeric: tabular-nums; }
.hero__scroll { color: var(--ink); }
.hero__scroll:hover { color: var(--muted); }

/* ---------- Marquee ---------- */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; padding: 18px 0; white-space: nowrap;
}
.marquee__track { display: inline-flex; animation: scroll 28s linear infinite; }
.marquee__track span {
  font-family: var(--display); font-size: clamp(1.4rem, 4vw, 2.6rem);
  text-transform: uppercase; letter-spacing: -0.02em; font-weight: 500;
}
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- Blocks ---------- */
.block { padding: clamp(60px, 9vw, 130px) var(--pad); border-bottom: 1px solid var(--line); }
.block__head {
  display: flex; align-items: baseline; gap: 14px; margin-bottom: 56px;
  font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em;
}
.block__num { color: var(--ink); }
.block__label { border-left: 1px solid var(--line); padding-left: 14px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(30px, 6vw, 90px); }
.about__statement {
  font-family: var(--display); font-weight: 400; font-size: clamp(1.6rem, 3.6vw, 3rem);
  line-height: 1.12; letter-spacing: -0.02em;
}
.about__statement em { color: var(--muted); }
.avatar { margin: 0 0 30px; width: max-content; }
.avatar img {
  display: block; width: clamp(168px, 26vw, 208px); height: auto;
  image-rendering: pixelated; image-rendering: crisp-edges;
  border: 1px solid var(--line); background: #f1efe8;
}
.avatar figcaption {
  margin-top: 10px; font-family: var(--mono); font-size: 0.72rem;
  letter-spacing: 0.06em; color: var(--muted);
}
.about__col p { color: var(--muted); margin-bottom: 18px; font-size: 0.92rem; }
.about__col strong { color: var(--ink); }
.about__facts { list-style: none; margin-top: 30px; border-top: 1px solid var(--line); }
.about__facts li {
  display: flex; justify-content: space-between; gap: 16px; padding: 12px 0;
  border-bottom: 1px solid var(--line); font-size: 0.84rem; text-align: right;
}
.about__facts li span { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; text-align: left; }

/* ---------- Work ---------- */
.work { border-top: 1px solid var(--line); }
.job { border-bottom: 1px solid var(--line); }
.job__row {
  width: 100%; background: none; border: none; cursor: pointer; color: var(--ink);
  font-family: var(--mono); text-align: left;
  display: grid; grid-template-columns: 120px 1.4fr 1.4fr 110px 30px;
  align-items: center; gap: 20px; padding: 26px 10px;
  transition: padding 0.3s ease, background 0.3s ease, color 0.3s ease;
}
.job__row:hover { background: var(--hover); color: var(--hover-ink); padding-left: 26px; padding-right: 26px; }
.job__id { font-size: 0.78rem; color: var(--muted); }
.job__row:hover .job__id { color: var(--hover-ink); opacity: 0.7; }
.job__title { font-family: var(--display); font-size: clamp(1.1rem, 2.2vw, 1.7rem); font-weight: 500; letter-spacing: -0.01em; }
.job__org { font-size: 0.86rem; color: var(--muted); }
.job__row:hover .job__org { color: var(--hover-ink); opacity: 0.8; }
.job__year { font-size: 0.82rem; text-align: right; }
.job__plus { font-size: 1.4rem; text-align: center; transition: transform 0.3s ease; line-height: 1; }
.job__row[aria-expanded="true"] .job__plus { transform: rotate(45deg); }

.job__detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s ease; }
.job__detail-inner { overflow: hidden; }
.job__row[aria-expanded="true"] + .job__detail { grid-template-rows: 1fr; }
.job__detail-inner > * { padding-left: 140px; }
.job__detail-inner > p { color: var(--muted); padding-top: 4px; padding-bottom: 16px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; }
.job__detail-inner ul { list-style: none; display: grid; gap: 10px; padding-bottom: 18px; }
.job__detail-inner li { position: relative; color: var(--muted); font-size: 0.92rem; }
.job__detail-inner li::before { content: "—"; position: absolute; left: -28px; color: var(--ink); }
.job__detail-inner strong { color: var(--ink); }
.job__tags { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 26px; }
.job__tags span {
  font-size: 0.72rem; padding: 4px 11px; border: 1px solid var(--line); border-radius: 30px;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.job__link { display: inline-block; padding-bottom: 28px; font-size: 0.84rem; border-bottom: 1px solid; }

/* ---------- Projects ---------- */
.projects {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line);
}
.project {
  background: var(--bg); padding: 34px; display: flex; flex-direction: column; gap: 16px;
  transition: background 0.3s ease;
}
.project:hover { background: var(--bg-2); }
.project__top {
  display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.project__title { font-family: var(--display); font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 500; letter-spacing: -0.02em; }
.project__desc { color: var(--muted); font-size: 0.92rem; flex: 1; }
.project__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.project__tags span {
  font-size: 0.72rem; padding: 4px 11px; border: 1px solid var(--line); border-radius: 30px;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.project__links { display: flex; gap: 22px; margin-top: 4px; }
.project__links a { font-size: 0.86rem; border-bottom: 1px solid; padding-bottom: 2px; }
.project__links a:hover { color: var(--muted); }
.project--add { background: var(--bg-2); }
.project--add .project__title { color: var(--muted); }

/* ---------- Stack ---------- */
.stack { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.stack__group h3 {
  font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--muted); padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line);
}
.stack__group ul { list-style: none; display: grid; gap: 10px; }
.stack__group li { font-family: var(--display); font-size: 1.2rem; transition: transform 0.2s ease, opacity 0.2s ease; }
.stack__group li:hover { transform: translateX(6px); opacity: 0.6; }

/* ---------- Education ---------- */
.edu__title { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; flex-wrap: wrap; }
.edu__title h3 { font-family: var(--display); font-size: clamp(1.6rem, 4vw, 3rem); font-weight: 500; letter-spacing: -0.02em; }
.edu__title span { font-size: 0.85rem; color: var(--muted); }
.edu__degree { color: var(--muted); margin: 8px 0 40px; font-size: 0.9rem; }
.edu__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; border-top: 1px solid var(--line); padding-top: 30px; }
.edu__grid h4 { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 14px; }
.edu__grid p { font-size: 0.95rem; line-height: 1.8; }

/* ---------- Contact ---------- */
.contact { padding: clamp(70px, 12vw, 160px) var(--pad); }
.contact__big {
  display: block; font-family: var(--display); font-weight: 500;
  font-size: clamp(3rem, 13vw, 12rem); line-height: 0.9; letter-spacing: -0.04em;
  text-transform: uppercase; margin: 30px 0 60px; transition: opacity 0.3s ease;
}
.contact__big .line { display: block; }
.contact__big .line:nth-child(2) { padding-left: 1.2em; }
.contact__big:hover { opacity: 0.55; }
.contact__links { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); max-width: 760px; }
.contact__links a {
  background: var(--bg); padding: 26px 28px; display: flex; flex-direction: column; gap: 10px;
  font-size: 1.05rem; transition: background 0.3s ease, color 0.3s ease;
}
.contact__links a:hover { background: var(--hover); color: var(--hover-ink); }
.contact__k { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.contact__links a:hover .contact__k { color: var(--hover-ink); opacity: 0.7; }

/* ---------- Footer ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 26px var(--pad); font-size: 0.76rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .stack { grid-template-columns: 1fr 1fr; }
  .projects { grid-template-columns: 1fr; }
  .edu__grid { grid-template-columns: 1fr; }
  .nav__menu { display: none; }
  .nav__toggle { display: inline-flex; }
}
@media (max-width: 720px) {
  .job__row { grid-template-columns: 1fr 30px; gap: 6px 14px; padding: 22px 6px; }
  .job__id { grid-column: 1; font-size: 0.7rem; }
  .job__plus { grid-row: 1 / span 2; grid-column: 2; }
  .job__title { grid-column: 1; }
  .job__org { grid-column: 1; }
  .job__year { grid-column: 1; text-align: left; color: var(--muted); }
  .job__row:hover { padding-left: 12px; padding-right: 12px; }
  .job__detail-inner > * { padding-left: 6px; }
  .job__detail-inner li::before { display: none; }
  .job__detail-inner li { padding-left: 14px; }
  .job__detail-inner li::after { content: "—"; position: absolute; left: 0; color: var(--ink); }
  .contact__links { grid-template-columns: 1fr; }
  .nav__contrast { font-size: 0; gap: 0; }
  .hero__bottom { flex-direction: column; align-items: flex-start; }
  .hero__meta { text-align: left; }
}
@media (max-width: 480px) {
  .stack { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   eDEX terminal chrome — skins the default theme.
   Neutralised in the cream editorial theme (--glow:none / --scan:0).
   ============================================================ */

/* Neon glow on display type */
.hero__title, .contact__big { text-shadow: var(--glow-strong); }
.about__statement, .job__title, .project__title, .edu__title h3 { text-shadow: var(--glow); }

/* Accent the signature marks + system bits */
.star { color: var(--accent); filter: drop-shadow(var(--glow)); }
.pulse { background: var(--accent); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 230, 164, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(47, 230, 164, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 230, 164, 0); }
}
.bin, .hero__avail { color: var(--accent); }
.block__num { color: var(--accent); text-shadow: var(--glow); }
.block__label::before { content: "// "; color: var(--accent); }

/* Links pick up the accent */
.hero__scroll:hover, .project__links a:hover, .job__link:hover, .mobile-menu a:hover {
  color: var(--accent); text-shadow: var(--glow);
}

/* HUD targeting brackets on modules */
.project, .avatar { position: relative; }
.project::before, .avatar::before {
  content: ""; position: absolute; top: 7px; left: 7px; width: 11px; height: 11px;
  border-top: 1px solid var(--accent); border-left: 1px solid var(--accent);
  opacity: 0.7; pointer-events: none;
}
.project::after, .avatar::after {
  content: ""; position: absolute; bottom: 7px; right: 7px; width: 11px; height: 11px;
  border-bottom: 1px solid var(--accent); border-right: 1px solid var(--accent);
  opacity: 0.7; pointer-events: none;
}

/* Avatar as a face-scan readout */
.avatar { padding: 12px; border: 1px solid var(--line); }
.avatar img { border-color: var(--accent); box-shadow: var(--glow); background: var(--panel); }
.avatar figcaption { color: var(--accent); text-shadow: var(--glow); }

/* ---------- Boot intro (eDEX-style) ---------- */
.boot {
  position: fixed; inset: 0; z-index: 10000;
  background: #04100b; color: #2fe6a4;
  font-family: var(--mono); font-size: clamp(0.72rem, 1.6vw, 0.9rem); line-height: 1.75;
  display: flex; align-items: center; padding: clamp(24px, 7vw, 90px);
  text-shadow: 0 0 6px rgba(47, 230, 164, 0.45);
}
.boot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.3) 0, rgba(0,0,0,0.3) 1px, transparent 1px, transparent 3px);
}
.boot.is-done { opacity: 0; visibility: hidden; transition: opacity 0.5s ease, visibility 0.5s; }
.boot__inner { width: 100%; max-width: 760px; position: relative; z-index: 1; }
.boot__log { white-space: pre-wrap; margin: 0; min-height: 1px; }
.boot__log .ok { color: #2fe6a4; }
.boot__log .dim { color: #2f7d63; }
.boot__log .hl { color: #d3f7e4; }
.boot__bar { margin-top: 22px; height: 6px; border: 1px solid rgba(47, 230, 164, 0.4); }
.boot__bar i { display: block; height: 100%; width: 0; background: #2fe6a4; box-shadow: 0 0 10px rgba(47, 230, 164, 0.6); transition: width 0.18s ease; }
.boot__hint { margin-top: 14px; color: #2f7d63; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; }
.boot__caret {
  display: inline-block; width: 0.6em; height: 1.05em; background: #2fe6a4;
  vertical-align: -0.18em; margin-left: 1px; box-shadow: 0 0 8px rgba(47, 230, 164, 0.6);
  animation: bootblink 1s steps(1) infinite;
}
@keyframes bootblink { 50% { opacity: 0; } }
