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

:root {
  --ink: #18324b;
  --ink-soft: #526b7c;
  --paper: #f8fafc;
  --line: rgba(74, 139, 184, .24);
  --accent: #256b8f;
  --border: rgba(24, 50, 75, .18);
  --logo-bg: rgba(255, 255, 255, .72);
  --control-bg: rgba(248, 250, 252, .96);
  --rule: 32px;
  --content-width: 56rem;
  --page-gutter: clamp(1rem, 4vw, 3rem);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ink: #d9e9f2;
  --ink-soft: #9bb4c3;
  --paper: #101820;
  --line: rgba(77, 148, 196, .18);
  --accent: #78c2e8;
  --border: rgba(217, 233, 242, .17);
  --logo-bg: rgba(255, 255, 255, .09);
  --control-bg: rgba(16, 24, 32, .96);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #d9e9f2;
    --ink-soft: #9bb4c3;
    --paper: #101820;
    --line: rgba(77, 148, 196, .18);
    --accent: #78c2e8;
    --border: rgba(217, 233, 242, .17);
    --logo-bg: rgba(255, 255, 255, .09);
    --control-bg: rgba(16, 24, 32, .96);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  font-size: 16px;
  scrollbar-gutter: stable;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 1rem;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.notebook,
.page {
  width: 100%;
  min-height: 100vh;
}

.page {
  overflow: hidden;
  padding: var(--rule) var(--page-gutter);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px), var(--line) var(--rule)),
    repeating-linear-gradient(to right, transparent 0, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px), var(--line) var(--rule));
}

.writing,
.portfolio,
footer {
  width: min(100%, var(--content-width));
  margin-right: auto;
  margin-left: auto;
}

.theme-switcher {
  position: fixed;
  z-index: 10;
  top: .75rem;
  right: max(var(--page-gutter), calc((100vw - var(--content-width)) / 2));
  display: flex;
  height: 2rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: .4rem;
  background: var(--control-bg);
  box-shadow: 0 .25rem .75rem rgba(5, 20, 32, .08);
  backdrop-filter: blur(8px);
}

.theme-switcher button {
  min-width: 3rem;
  height: 100%;
  padding: 0 .65rem;
  border: 0;
  border-right: 1px solid var(--border);
  color: var(--ink-soft);
  background: transparent;
  font: inherit;
  font-size: .75rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

.theme-switcher button:first-child { min-width: 3.75rem; }
.theme-switcher button:last-child { border-right: 0; }
.theme-switcher button:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.theme-switcher button[aria-pressed="true"] { color: var(--paper); background: var(--ink); }
.theme-switcher button:focus-visible { position: relative; outline: 2px solid var(--accent); outline-offset: -2px; }

.date,
.lead,
.draft-note,
.social-links,
.item-copy h3,
.item-copy p,
footer {
  line-height: var(--rule);
}

.date {
  margin: 0;
  color: var(--ink-soft);
  font-size: .875rem;
}

h1 {
  margin: 0 0 calc(var(--rule) / 2);
  font-size: clamp(2.5rem, 5vw, 3rem);
  font-weight: 600;
  line-height: calc(var(--rule) * 2);
  letter-spacing: -.04em;
}

.lead {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 500;
}

.draft-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  margin-top: calc(var(--rule) / 2);
  font-size: .9375rem;
  font-weight: 500;
}

.social-links a,
.item-copy a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: .22rem;
}

.social-links a:hover,
.item-copy a:hover { color: var(--accent); }

.social-links a:focus-visible,
.item-copy a:focus-visible {
  border-radius: .15rem;
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.portfolio { margin-top: var(--rule); }
.portfolio-section + .portfolio-section { margin-top: var(--rule); }

.section-heading {
  margin: 0;
  color: var(--accent);
  font-size: .8125rem;
  font-weight: 600;
  line-height: var(--rule);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  margin: 0;
  padding: 0 0 calc(var(--rule) / 2);
}

.item-main {
  display: grid;
  grid-template-columns: var(--rule) minmax(0, 1fr);
  gap: calc(var(--rule) / 2);
  align-items: start;
}

.item-logo {
  width: var(--rule);
  height: var(--rule);
  margin-top: calc(var(--rule) / 2);
  padding: .15rem;
  border: 1px solid var(--border);
  border-radius: .3rem;
  object-fit: contain;
  background: var(--logo-bg);
  filter: saturate(.72);
}

.period {
  margin: 0;
  color: var(--ink-soft);
  font-size: .75rem;
  font-weight: 500;
  line-height: calc(var(--rule) / 2);
  letter-spacing: .01em;
}

.item-copy {
  min-width: 0;
  overflow-wrap: anywhere;
}

.item-copy h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.item-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: .9375rem;
}

.item-copy .organization {
  color: var(--ink);
  font-weight: 500;
}

.certificate-list li { padding-bottom: var(--rule); }
.certificate-list .item-logo { margin-top: 0; }

footer {
  margin-top: var(--rule);
  color: var(--ink-soft);
  font-size: .75rem;
  letter-spacing: .04em;
}

@media (max-width: 700px) {
  :root {
    --rule: 28px;
    --page-gutter: 1rem;
  }

  h1 {
    font-size: clamp(2.25rem, 12vw, 2.75rem);
    line-height: calc(var(--rule) * 2);
  }

  .lead { font-size: 1.0625rem; }
  .social-links { gap: 0 1.25rem; }
  .theme-switcher { right: var(--page-gutter); }
  .theme-switcher button { padding: 0 .55rem; }
}

@media print {
  :root {
    --ink: #111827;
    --ink-soft: #4b5563;
    --paper: #fff;
    --line: rgba(74, 139, 184, .2);
  }

  .theme-switcher { display: none; }
}
