/* =========================================================================
   meganwong.me
   Swiss grid. One sans family, hard rules, numbered bands, no ornament.

   Deliberately absent: backdrop blur, drop shadows, rounded cards,
   scroll-reveal animation, gradient anything. The grid does the work.

   Contents
     1. Tokens
     2. Reset & base
     3. Grid primitives
     4. Header
     5. Hero
     6. Bands (numbered sections)
     7. Rows, tables, lists
     8. Buttons & links
     9. CV
    10. Footer
    11. Dark mode
    12. Print
   ========================================================================= */

/* ---------- 1. Tokens ---------------------------------------------------- */

:root {
  /* Cool paper, hard ink, Swiss red. */
  --paper: #f4f4f2;
  --paper-2: #eaeae7;
  --ink: #111111;
  --muted: #6e6e6b;
  --rule: #d2d2ce;
  --accent: #d6300f;
  --on-accent: #ffffff;

  --font: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;

  /* Display sizes run big and tight; body stays sober. */
  --t-display: clamp(2.75rem, 1rem + 8.5vw, 8rem);
  --t-xl: clamp(1.75rem, 1.1rem + 3vw, 3.25rem);
  --t-l: clamp(1.25rem, 1.05rem + 0.9vw, 1.75rem);
  --t-m: clamp(1rem, 0.97rem + 0.16vw, 1.1rem);
  --t-s: 0.8125rem;
  --t-xs: 0.6875rem;

  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-s: 1rem;
  --space-m: 1.5rem;
  --space-l: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 5.5rem;

  --page: 84rem;
  --measure: 60ch;

  --label-col: 12rem;

  color-scheme: light;
}

/* ---------- 2. Reset & base --------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-m);
  font-weight: 400;
  line-height: 1.55;
  font-feature-settings: "ss01" 1;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}

p {
  margin: 0 0 var(--space-s);
}

p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* dd carries a 40px inline-start margin by default, which breaks the
   label/value alignment in .table once it stacks. */
dl,
dt,
dd {
  margin: 0;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
}

/* Square, offset, unmistakable. No rounded focus rings. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  padding: var(--space-2xs) var(--space-s);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-100%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

/* ---------- 3. Grid primitives ------------------------------------------ */

.wrap {
  width: 100%;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--space-s);
}

@media (min-width: 40em) {
  .wrap {
    padding-inline: var(--space-m);
  }
}

/* The recurring two-column split: index label | content.
   Below the breakpoint it collapses to a stack, no vertical rule. */
.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-m);
}

@media (min-width: 56em) {
  .split {
    grid-template-columns: var(--label-col) 1fr;
    gap: 0;
  }

  .split__label {
    padding-right: var(--space-l);
    border-right: 1px solid var(--rule);
  }

  .split__body {
    padding-left: var(--space-l);
  }
}

/* Small uppercase metadata. Used for index numbers, labels, captions. */
.meta {
  display: block;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.meta--ink {
  color: var(--ink);
}

.stack > * + * {
  margin-top: var(--space-s);
}

.prose {
  max-width: var(--measure);
}

.prose p {
  margin-bottom: var(--space-s);
}

/* ---------- 4. Header ---------------------------------------------------- */

/* Solid, always-ruled, no blur, no scroll state. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  min-height: 3.25rem;
}

.wordmark {
  font-size: var(--t-s);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark:hover {
  color: var(--accent);
}

.nav {
  margin-left: auto;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-m);
}

.nav__link {
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  transition: color 120ms linear;
}

.nav__link:hover,
.nav__link[aria-current="true"] {
  color: var(--accent);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  margin-left: var(--space-m);
}

/* Text toggle, not a sun/moon icon. */
.theme-toggle {
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 120ms linear;
}

.theme-toggle:hover {
  color: var(--accent);
}

html:not(.js) .theme-toggle {
  display: none;
}

.nav__toggle {
  display: none;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
}

.nav__toggle .label-close {
  display: none;
}

.nav__toggle[aria-expanded="true"] .label-open {
  display: none;
}

.nav__toggle[aria-expanded="true"] .label-close {
  display: inline;
}

@media (max-width: 47.99em) {
  .nav__toggle {
    display: block;
  }

  .site-header__actions {
    margin-left: auto;
  }

  .nav {
    margin-left: 0;
  }

  .nav__list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--ink);
  }

  .nav__list.is-open {
    display: flex;
  }

  .nav__link {
    display: block;
    padding: var(--space-s) var(--space-m);
    font-size: var(--t-s);
    border-top: 1px solid var(--rule);
  }
}

/* ---------- 5. Hero ------------------------------------------------------ */

.hero {
  padding-block: var(--space-l) var(--space-xl);
  border-bottom: 1px solid var(--ink);
}

@media (min-width: 56em) {
  .hero {
    padding-block: var(--space-xl) var(--space-2xl);
  }
}

.hero__label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.hero__display {
  font-size: var(--t-display);
  line-height: 0.88;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.hero__display span {
  display: block;
}

/* The name is the headline; the role is the designation beneath it. */

.hero__role {
  margin-top: var(--space-m);
  font-size: var(--t-l);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero__lede {
  margin-top: var(--space-s);
  max-width: 34ch;
  font-size: var(--t-l);
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--muted);
}

/* Cities as a data row: code above, name beneath. */
.trail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: var(--space-xl);
  border-top: 1px solid var(--rule);
}

@media (min-width: 40em) {
  .trail {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.trail li {
  padding: var(--space-s) var(--space-s) var(--space-s) 0;
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 40em) {
  .trail li {
    border-bottom: 0;
    border-right: 1px solid var(--rule);
  }

  .trail li:last-child {
    border-right: 0;
  }

  .trail li + li {
    padding-left: var(--space-s);
  }
}

.trail__code {
  display: block;
  font-size: var(--t-l);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}

.trail li:last-child .trail__code {
  color: var(--accent);
}

.trail__place {
  display: block;
  margin-top: var(--space-3xs);
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- 6. Bands ----------------------------------------------------- */

.band {
  padding-block: var(--space-xl);
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 56em) {
  .band {
    padding-block: var(--space-2xl);
  }
}

.band__title {
  margin-top: var(--space-2xs);
  font-size: var(--t-l);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

@media (min-width: 56em) {
  .band__label {
    position: sticky;
    top: 5rem;
    align-self: start;
  }
}

.band__intro {
  max-width: var(--measure);
  font-size: var(--t-l);
  line-height: 1.35;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-l);
}

/* ---------- 7. Rows, tables, lists --------------------------------------- */

/* Numbered index rows. Replaces the card grid entirely. */
.rows {
  border-top: 1px solid var(--ink);
}

.row {
  border-bottom: 1px solid var(--rule);
}

.row__link,
.row__inner {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: var(--space-2xs) var(--space-s);
  align-items: baseline;
  padding-block: var(--space-m);
  text-decoration: none;
  color: inherit;
}

@media (min-width: 48em) {
  .row__link,
  .row__inner {
    grid-template-columns: 3.5rem minmax(0, 18rem) minmax(0, 1fr) 2rem;
  }
}

.row__num {
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row__title {
  font-size: var(--t-l);
  letter-spacing: -0.02em;
}

.row__desc {
  grid-column: 2 / -1;
  font-size: var(--t-s);
  line-height: 1.5;
  color: var(--muted);
}

@media (min-width: 48em) {
  .row__desc {
    grid-column: auto;
  }
}

.row__arrow {
  display: none;
  font-size: var(--t-l);
  color: var(--muted);
  justify-self: end;
  transition: transform 140ms linear, color 140ms linear;
}

@media (min-width: 48em) {
  .row__arrow {
    display: block;
  }
}

.row__link:hover .row__title,
.row__link:focus-visible .row__title {
  color: var(--accent);
}

.row__link:hover .row__arrow {
  color: var(--accent);
  transform: translateX(4px);
}

.row--pending .row__title {
  color: var(--muted);
}

/* Label/value table. Used for contact and details. */
.table {
  border-top: 1px solid var(--ink);
}

.table__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3xs);
  padding-block: var(--space-s);
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 40em) {
  .table__row {
    grid-template-columns: 8rem 1fr;
    gap: var(--space-s);
    align-items: baseline;
  }
}

.table__value {
  font-size: var(--t-m);
}

/* Inline link: underline is a rule, not a decoration. */
.link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color 120ms linear, border-color 120ms linear;
}

.link:hover,
.link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Tag list */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs) var(--space-s);
  border-top: 1px solid var(--rule);
  padding-top: var(--space-s);
}

.tags li {
  font-size: var(--t-s);
  color: var(--muted);
}

.tags li::after {
  content: " /";
  color: var(--rule);
}

.tags li:last-child::after {
  content: "";
}

/* ---------- 8. Buttons --------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-m);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 120ms linear, border-color 120ms linear,
    color 120ms linear;
}

.button:hover,
.button:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button--ghost {
  color: var(--ink);
  background: transparent;
}

.button--ghost:hover,
.button--ghost:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin-top: var(--space-l);
}

/* ---------- 9. CV -------------------------------------------------------- */

.page-head {
  padding-block: var(--space-l) var(--space-xl);
  border-bottom: 1px solid var(--ink);
}

.page-head__display {
  font-size: clamp(2.5rem, 1.2rem + 6vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.page-head__sub {
  margin-top: var(--space-m);
  max-width: 40ch;
  font-size: var(--t-l);
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--muted);
}

.roles {
  border-top: 1px solid var(--ink);
}

.role {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2xs);
  padding-block: var(--space-m);
  border-bottom: 1px solid var(--rule);
}

@media (min-width: 48em) {
  .role {
    grid-template-columns: 3.5rem 9rem 1fr;
    gap: var(--space-s);
  }
}

.role__num {
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.role__dates {
  font-size: var(--t-s);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.role__title {
  font-size: var(--t-l);
  letter-spacing: -0.02em;
}

.role__org {
  display: block;
  margin-top: var(--space-3xs);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.role__points {
  margin-top: var(--space-s);
  display: grid;
  gap: var(--space-2xs);
}

.role__points li {
  position: relative;
  padding-left: 1.25rem;
  font-size: var(--t-s);
  line-height: 1.5;
  color: var(--muted);
}

.role__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 0.6rem;
  height: 1px;
  background: var(--rule);
}

/* ---------- 10. Footer --------------------------------------------------- */

.site-footer {
  padding-block: var(--space-m);
  border-top: 1px solid var(--ink);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-s);
  font-size: var(--t-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms linear;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
}

/* ---------- 11. Dark mode ------------------------------------------------ */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e0e0d;
    --paper-2: #171716;
    --ink: #ededea;
    --muted: #8d8d88;
    --rule: #2c2c2a;
    --accent: #ff5230;
    --on-accent: #0e0e0d;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #0e0e0d;
  --paper-2: #171716;
  --ink: #ededea;
  --muted: #8d8d88;
  --rule: #2c2c2a;
  --accent: #ff5230;
  --on-accent: #0e0e0d;

  color-scheme: dark;
}

/* ---------- 12. Motion --------------------------------------------------- */

/* No scroll-reveal. The only motion is hover feedback and anchor scrolling. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
    scroll-padding-top: 4.5rem;
  }
}

/* ---------- 13. Print ---------------------------------------------------- */

@media print {
  @page {
    margin: 14mm;
  }

  :root {
    --paper: #fff;
    --paper-2: #fff;
    --ink: #000;
    --muted: #333;
    --rule: #bbb;
    --accent: #000;
  }

  html {
    font-size: 10.5pt;
  }

  body {
    background: #fff;
    color: #000;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .button-row,
  .no-print {
    display: none !important;
  }

  .wrap {
    max-width: none;
    padding-inline: 0;
  }

  .band,
  .page-head {
    padding-block: 0 var(--space-s);
    border-bottom: 0;
  }

  .split {
    display: block;
  }

  .split__label {
    padding-right: 0;
    border-right: 0;
    margin-bottom: var(--space-2xs);
    position: static;
  }

  .split__body {
    padding-left: 0;
  }

  .role,
  .row {
    break-inside: avoid;
  }

  a {
    text-decoration: none;
  }

  .prose a[href^="http"]::after,
  .table a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
}
