/* Jasman Tan — portfolio. One stylesheet, no framework, no build step. */

:root {
  color-scheme: light dark;

  --bg: #fbfaf8;
  --bg-alt: #f2f0ec;
  --surface: #ffffff;
  --border: #ddd8d0;
  --border-strong: #c3bcb1;
  --text: #1b1a18;
  --text-muted: #55514b;
  --accent: #8a4b1f;
  --accent-text: #ffffff;
  --accent-soft: #f4e7dc;
  --shadow: 0 1px 2px rgba(27, 26, 24, .06), 0 8px 24px -16px rgba(27, 26, 24, .25);

  --wrap: 68rem;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --bg-alt: #14171d;
    --surface: #171a21;
    --border: #2a2f39;
    --border-strong: #3c434f;
    --text: #e9e7e3;
    --text-muted: #a7a89f;
    --accent: #e8a06a;
    --accent-text: #1a1206;
    --accent-soft: #2a2119;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -20px rgba(0, 0, 0, .9);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-alt: #14171d;
  --surface: #171a21;
  --border: #2a2f39;
  --border-strong: #3c434f;
  --text: #e9e7e3;
  --text-muted: #a7a89f;
  --accent: #e8a06a;
  --accent-text: #1a1206;
  --accent-soft: #2a2119;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -20px rgba(0, 0, 0, .9);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

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

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 6vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); }
h3 { font-size: 1.16rem; }
h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); font-weight: 650; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }

a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

code { font-family: var(--mono); font-size: .9em; background: var(--bg-alt); padding: .1em .35em; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--accent); color: var(--accent-text);
  padding: .6rem 1rem; border-radius: var(--radius); text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ topbar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; gap: 1rem; min-height: 56px; }
.wordmark { font-weight: 640; text-decoration: none; letter-spacing: -.02em; white-space: nowrap; }
.topbar nav { margin-left: auto; display: flex; gap: .15rem; flex-wrap: wrap; }
.topbar nav a {
  text-decoration: none; color: var(--text-muted);
  padding: .35rem .6rem; border-radius: 7px; font-size: .92rem;
}
.topbar nav a:hover { color: var(--text); background: var(--bg-alt); }
/* On phones the section links wrap to three rows and swallow the screen —
   the page is short enough to scroll, so keep only the résumé link. */
@media (max-width: 47rem) {
  .topbar nav a:not(.nav-keep) { display: none; }
}

.theme-toggle {
  flex: none; display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
}
.theme-toggle:hover { color: var(--text); background: var(--bg-alt); }
.theme-toggle svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* -------------------------------------------------------------------- hero */

.hero { padding: clamp(3rem, 9vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem); }
.eyebrow {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .11em;
  color: var(--text-muted); margin-bottom: .6rem; font-weight: 600;
}
.hero h1 { margin-bottom: 1rem; }
.lede { font-size: clamp(1.12rem, 2.4vw, 1.4rem); max-width: 48ch; color: var(--text); }
.hero-body { max-width: 62ch; color: var(--text-muted); }
.seeking {
  max-width: 62ch; border-left: 3px solid var(--accent);
  padding: .1rem 0 .1rem 1rem; color: var(--text-muted);
}
.seeking strong { color: var(--text); }
.hero-actions, .cta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }

.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .58rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); text-decoration: none; font-size: .95rem; font-weight: 550;
  font-family: inherit; cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.btn:hover { border-color: var(--text-muted); transform: translateY(-1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-disabled { opacity: .6; cursor: default; }
.btn-disabled:hover { transform: none; border-color: var(--border-strong); }

/* ---------------------------------------------------------------- sections */

.section { padding: clamp(3rem, 7vw, 5rem) 0; border-top: 1px solid var(--border); }
.section-alt { background: var(--bg-alt); }
.section-lede { max-width: 60ch; color: var(--text-muted); margin-bottom: 2.2rem; }
.h2-sub { margin-top: 3rem; }

/* ---------------------------------------------------------------- projects */

.projects { display: grid; gap: 1.25rem; }
.project {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: clamp(1.25rem, 3vw, 1.9rem);
  box-shadow: var(--shadow);
}
.project-featured { border-color: var(--accent); }
.project-head h3 { margin-bottom: .25rem; font-size: 1.35rem; }
.project-featured .project-head h3 { font-size: 1.6rem; }
.tagline { color: var(--text-muted); max-width: 62ch; margin-bottom: .6rem; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 0; }
.badge {
  display: inline-block; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase;
  font-weight: 640; padding: .2rem .55rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--text); border: 1px solid var(--border);
}
.blurb {
  margin: 1rem 0 0; padding: .1rem 0 .1rem 1rem;
  border-left: 2px solid var(--border-strong); max-width: 68ch;
}
.blurb p { font-style: italic; color: var(--text-muted); margin-bottom: .3rem; }
.blurb cite { font-style: normal; font-size: .8rem; color: var(--text-muted); }

.awards {
  margin-top: 1.4rem; padding: 1rem 1.15rem;
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: 10px;
}
.awards h4 { margin-bottom: .35rem; }
.award-main { font-weight: 640; margin-bottom: .5rem; }
.awards ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: .35rem .5rem;
}
.awards ul li {
  font-size: .85rem; color: var(--text-muted);
  border: 1px solid var(--border-strong); border-radius: 999px; padding: .12rem .6rem;
}

.credits { margin-top: .4rem; }
.credits summary {
  cursor: pointer; font-size: .85rem; color: var(--text-muted);
  font-weight: 600; padding: .25rem 0;
}
.credits summary:hover { color: var(--text); }
.credits ul {
  list-style: none; margin: .7rem 0; padding: 0;
  display: grid; gap: .25rem .9rem; font-size: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}
.c-name { font-weight: 600; }
.c-role { color: var(--text-muted); }

.project-body { display: grid; gap: 1.1rem; margin: 1.4rem 0; }
.project-body > .note, .project-body > .credits { grid-column: 1 / -1; }
@media (min-width: 60rem) {
  .project-featured .project-body { grid-template-columns: 1fr 1.5fr 1fr; gap: 1.6rem; }
}
.pb h4 { margin-bottom: .35rem; }
.pb p { color: var(--text-muted); max-width: 70ch; }
.note {
  font-size: .86rem; color: var(--text-muted);
  border-left: 2px solid var(--border-strong); padding-left: .8rem; max-width: 72ch;
}
.project-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem;
  border-top: 1px solid var(--border); padding-top: 1.1rem;
}
.stack { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; flex: 1 1 18rem; }
.stack li {
  font-size: .8rem; font-family: var(--mono);
  padding: .18rem .5rem; border: 1px solid var(--border); border-radius: 6px; color: var(--text-muted);
}

/* ------------------------------------------------------------------- infra */

.infra-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
@media (min-width: 42rem) { .infra-grid { grid-template-columns: repeat(2, 1fr); } }
.infra-grid li {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.25rem;
}
.infra-grid h3 { font-size: 1.02rem; }
.infra-grid p { color: var(--text-muted); font-size: .95rem; margin: 0; }

/* ------------------------------------------------------------------ skills */

.skills { display: grid; gap: 1.5rem; }
@media (min-width: 42rem) { .skills { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem) { .skills { grid-template-columns: repeat(3, 1fr); } }
.skill-group h3 {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .09em;
  color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: .5rem;
}
.skill-group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.skill-group li {
  font-size: .88rem; padding: .2rem .55rem;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}

/* -------------------------------------------------------------- experience */

.timeline, .education { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem; }
.job-head h3 { margin-bottom: .1rem; }
.org { margin: 0; color: var(--text); font-weight: 550; }
.period { margin: 0 0 .8rem; color: var(--text-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.job ul, .resume ul { margin: 0; padding-left: 1.15rem; }
.job li, .resume li { margin-bottom: .5rem; color: var(--text-muted); }
.education { gap: 1.5rem; margin-bottom: 1rem; }
.education h3 { font-size: 1.05rem; margin-bottom: .1rem; }

/* ------------------------------------------------------------------ résumé */

.resume-bar { background: var(--bg-alt); border-bottom: 1px solid var(--border); padding: 1.1rem 0; }
.resume-bar p { color: var(--text-muted); max-width: 60ch; margin-bottom: .8rem; }
.resume-bar-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0; }

.resume { padding: clamp(2rem, 5vw, 3.5rem) 16px; max-width: 52rem; }
.resume h1 { font-size: clamp(1.9rem, 5vw, 2.5rem); margin-bottom: .8rem; }
.resume h2 {
  font-size: 1.15rem; text-transform: uppercase; letter-spacing: .08em;
  margin-top: 2.4rem; padding-bottom: .4rem; border-bottom: 1px solid var(--border);
}
.resume h3 { margin-top: 1.6rem; font-size: 1.05rem; }
.resume p { color: var(--text-muted); }
.resume > p:first-of-type { color: var(--text); font-size: 1.05rem; }

/* ------------------------------------------------------------------ footer */

.footer { border-top: 1px solid var(--border); padding: 2.5rem 0 3.5rem; background: var(--bg-alt); }
.footer-contact { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-bottom: .6rem; }
.notfound { padding: clamp(4rem, 14vw, 8rem) 16px; text-align: center; }

/* ------------------------------------------------------------------- print */

@media print {
  .no-print, .topbar, .footer, .skip-link, .theme-toggle { display: none !important; }
  @page { size: A4; margin: 14mm 14mm 16mm; }
  html, body {
    background: #fff !important; color: #000 !important;
    font-size: 10.5pt; line-height: 1.42;
  }
  .resume { max-width: none; padding: 0; margin: 0; }
  .resume h1 { font-size: 19pt; margin-bottom: .2rem; }
  .resume h2 {
    font-size: 11pt; margin-top: 12pt; margin-bottom: 4pt;
    border-bottom: .6pt solid #999; padding-bottom: 2pt;
    break-after: avoid; page-break-after: avoid;
  }
  .resume h3 { font-size: 10.5pt; margin-top: 8pt; break-after: avoid; page-break-after: avoid; }
  .resume p, .resume li { color: #000 !important; margin-bottom: 3pt; }
  .resume ul { padding-left: 14pt; margin-bottom: 4pt; }
  .resume li { break-inside: avoid; page-break-inside: avoid; }
  a { color: #000 !important; text-decoration: none; }
  code { background: none; }
}
