@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter.woff2) format("woff2");
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url(fonts/newsreader.woff2) format("woff2");
}

:root {
  color-scheme: light;
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #1a1a19;
  --muted: #6b6a66;
  --faint: #75736d;
  --line: #e0dcd5;
  --accent: #2f5bd3;
  --accent-soft: rgba(47, 91, 211, 0.08);
  --shadow: 0 1px 2px rgba(20, 18, 14, 0.04), 0 8px 24px -12px rgba(20, 18, 14, 0.12);
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", ui-serif, Georgia, serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --col: 42rem;
  --rail: 9rem;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e0f;
  --surface: #161618;
  --text: #ecebe8;
  --muted: #9b9a95;
  --faint: #7d7c76;
  --line: #303035;
  --accent: #8aa8ff;
  --accent-soft: rgba(138, 168, 255, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
p,
li,
dd {
  text-wrap: pretty;
}
h1,
h3 {
  text-wrap: balance;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection {
  background: var(--accent);
  color: var(--bg);
}
a {
  color: inherit;
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.page {
  max-width: var(--col);
  margin: 0 auto;
  padding: clamp(1.25rem, 5vw, 2rem) clamp(1.25rem, 5vw, 2rem) 4rem;
  padding-left: max(clamp(1.25rem, 5vw, 2rem), env(safe-area-inset-left));
  padding-right: max(clamp(1.25rem, 5vw, 2rem), env(safe-area-inset-right));
}

/* Top bar */
.bar {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  margin-right: -0.7rem;
  margin-bottom: clamp(2.5rem, 9vw, 5rem);
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--text);
}
.icon-btn:active {
  transform: scale(0.92);
}
.icon-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}
.theme-toggle .sun,
:root[data-theme="dark"] .theme-toggle .moon {
  display: none;
}
:root[data-theme="dark"] .theme-toggle .sun {
  display: block;
}

/* Header */
.intro h1 {
  font-family: var(--serif);
  font-weight: 450;
  font-size: clamp(2.5rem, 9vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 0.6rem;
  font-variation-settings: "opsz" 72;
}
.tagline {
  font-size: clamp(1.05rem, 3.6vw, 1.2rem);
  color: var(--muted);
  margin: 0;
  max-width: 34rem;
  line-height: 1.5;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0;
  list-style: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}
.chip svg {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--muted);
  flex: none;
}
.chip:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.chip:active {
  transform: scale(0.97);
}
.chip.primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.chip.primary svg {
  color: inherit;
}
.chip.primary:hover {
  background: color-mix(in srgb, var(--text) 86%, var(--accent));
}
.chip .copied {
  display: none;
}
.chip.is-copied .copied {
  display: inline;
}
.chip.is-copied .label {
  display: none;
}
.place {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Sections */
section {
  margin-top: clamp(3rem, 10vw, 4.5rem);
}
h2 {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.prose p {
  margin: 0 0 1em;
  max-width: 36rem;
}
.prose p:last-child {
  margin-bottom: 0;
}

/* Experience */
.roles {
  list-style: none;
  margin: 0;
  padding: 0;
}
.role {
  position: relative;
  padding-bottom: 2rem;
}
.role + .role {
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.role:last-child {
  padding-bottom: 0;
}
.role-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.1rem 1.25rem;
}
@media (max-width: 30rem) {
  .role-head {
    grid-template-columns: 1fr;
  }
  .role-head .when {
    order: 3;
    margin-top: 0.1rem;
  }
}
.role h3 {
  font-size: 1.075rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.35;
}
.role .org {
  grid-column: 1 / -1;
  order: 2;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.when {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.role ul {
  margin: 0.6rem 0 0;
  padding: 0;
  list-style: none;
}
.role li {
  position: relative;
  padding-left: 1.1rem;
  margin-top: 0.5rem;
  font-size: 0.975rem;
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
}
.role li::before {
  content: "";
  position: absolute;
  left: 0.1rem;
  top: 0.72em;
  width: 0.35rem;
  height: 1px;
  background: var(--faint);
}
.role .sub {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Projects */
.projects {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr;
}
@media (min-width: 40rem) {
  .projects {
    grid-template-columns: 1fr 1fr;
  }
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1.1rem 1.15rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
}
a.card:active {
  transform: translateY(0) scale(0.99);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.card h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  letter-spacing: -0.01em;
}
.card p {
  margin: 0;
  font-size: 0.925rem;
  color: var(--muted);
  line-height: 1.55;
}
.card .arrow {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.25em;
  width: 1.1rem;
  height: 1.1rem;
  color: var(--muted);
  transition: transform 0.35s var(--ease), color 0.35s var(--ease);
}
a.card:hover .arrow {
  transform: translate(2px, -2px);
  color: var(--accent);
}
.tag {
  font-size: 0.7rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  color: var(--muted);
  white-space: nowrap;
}
.card .kind {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: auto;
  padding-top: 0.4rem;
}

/* Two-column list (education, skills) */
.rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.rows li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.15rem 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}
.rows li:first-child {
  border-top: 0;
  padding-top: 0;
}
.rows strong {
  font-weight: 550;
}
.rows .detail {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.925rem;
}
.skills {
  display: grid;
  gap: 0.6rem;
}
.skills div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
}
.skills dt {
  color: var(--muted);
  font-size: 0.925rem;
}
.skills dd {
  margin: 0;
  font-size: 0.975rem;
}
@media (max-width: 30rem) {
  .skills div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--faint);
}
footer a {
  color: var(--muted);
}
footer a:hover {
  color: var(--text);
}

/* Desktop: section labels in a left rail */
@media (min-width: 56rem) {
  :root {
    --col: 52rem;
  }
  section {
    display: grid;
    grid-template-columns: var(--rail) 1fr;
    gap: 0 2rem;
  }
  section > h2 {
    margin: 0;
    padding-top: 0.3rem;
  }
  .intro {
    padding-left: calc(var(--rail) + 2rem);
  }
  footer {
    margin-left: calc(var(--rail) + 2rem);
  }
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.7s var(--ease) both;
    animation-delay: calc(var(--i, 0) * 70ms + 60ms);
  }
  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(10px);
      filter: blur(3px);
    }
  }
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.35s;
    animation-timing-function: var(--ease);
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* Print: one clean A4 page set, light, no controls */
@media print {
  @page {
    size: A4;
    margin: 10mm 14mm;
  }
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --text: #111;
    --muted: #4a4a4a;
    --faint: #6f6f6f;
    --line: #dcdcdc;
    --accent: #1f47b8;
    --accent-soft: transparent;
  }
  html {
    font-size: 9.6pt;
  }
  body {
    line-height: 1.45;
  }
  .page {
    max-width: none;
    padding: 0;
  }
  .bar,
  .no-print {
    display: none !important;
  }
  .rise {
    animation: none !important;
  }
  .intro h1 {
    font-size: 23pt;
    margin-bottom: 0.3rem;
  }
  .meta {
    margin-top: 0.7rem;
  }
  .chip,
  .chip.primary {
    border: 0;
    padding: 0;
    min-height: 0;
    background: none;
    color: var(--text);
    margin-right: 1rem;
  }
  .meta {
    gap: 0;
  }
  .place {
    margin-top: 0.3rem;
  }
  h2 {
    break-after: avoid;
  }
  #projects + .projects,
  section:has(#projects),
  section:has(#education),
  section:has(#skills) {
    break-inside: avoid;
  }
  .chip svg {
    display: none;
  }
  .chip .print-only {
    display: inline !important;
  }
  .chip .label {
    display: none;
  }
  section {
    margin-top: 1.6rem;
  }
  h2 {
    margin-bottom: 0.6rem;
    color: var(--muted);
  }
  .role {
    padding-bottom: 0.9rem;
    break-inside: avoid;
  }
  .role + .role {
    padding-top: 0.9rem;
  }
  .projects {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .card {
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    break-inside: avoid;
    box-shadow: none !important;
    transform: none !important;
  }
  .card .arrow,
  .tag {
    display: none;
  }
  .card .url {
    display: block !important;
    font-size: 0.8rem;
    color: var(--accent);
  }
  .rows li,
  .skills div {
    break-inside: avoid;
  }
  footer {
    margin-top: 2rem;
    padding-top: 0.6rem;
  }
  footer .no-print {
    display: none;
  }
  /* One A4 page: tighter rhythm, Education and Skills side by side */
  html {
    font-size: 9pt;
  }
  body {
    line-height: 1.4;
  }
  section {
    margin-top: 0.55rem;
  }
  h2 {
    margin-bottom: 0.4rem;
  }
  .role li {
    margin-top: 0.2rem;
  }
  .role ul {
    margin-top: 0.3rem;
  }
  .role {
    padding-bottom: 0.35rem;
  }
  .role + .role {
    padding-top: 0.35rem;
  }
  .rows li {
    padding: 0.35rem 0;
  }
  .skills {
    gap: 0.25rem;
  }
  .skills div {
    grid-template-columns: 6rem 1fr;
    gap: 0.6rem;
  }
  main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.75rem;
  }
  main > :not(section:has(#education)):not(section:has(#skills)) {
    grid-column: 1 / -1;
  }
  footer,
  .card .kind {
    display: none;
  }
  .card {
    gap: 0.2rem;
  }
}
.print-only,
.card .url {
  display: none;
}

