@layer reset, tokens, base, components, pages, utilities;

@font-face {
  font-family: "Inter";
  src: url("/assets/first-read/mpt-guide-inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body, h1, h2, h3, p, ul, figure, dl, dd { margin: 0; }
  ul { padding: 0; }
  img { display: block; max-width: 100%; }
  button { font: inherit; }
  [hidden] { display: none !important; }
}

@layer tokens {
  :root {
    color-scheme: dark;
    --mpt-ink: #171824;
    --mpt-panel: #202130;
    --mpt-panel-raised: #282939;
    --mpt-text: #f1eff7;
    --mpt-muted: #bbbace;
    --mpt-line: #45465d;
    --mpt-violet: #c2b3ff;
    --mpt-sage: #c7e8bd;
    --mpt-warm: #ffd0a9;
    --mpt-radius: 14px;
  }
}

@layer base {
  html { scroll-padding-top: 24px; }
  body {
    background: var(--mpt-ink);
    color: var(--mpt-text);
    font-family: "Inter", sans-serif;
    font-size: 18px;
    font-weight: 420;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
  }
  h1, h2, h3 { font-weight: 620; line-height: 1.13; text-wrap: balance; }
  h1 { font-size: clamp(2.55rem, 4.7vw, 4.7rem); letter-spacing: -.052em; max-width: 18ch; }
  h2, .mpt-section-heading { font-size: clamp(1.6rem, 2.5vw, 2.1rem); letter-spacing: -.035em; max-width: 28ch; }
  h3 { font-size: 1.35rem; letter-spacing: -.025em; }
  p { max-width: 66ch; }
  a {
    color: var(--mpt-violet);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding-block: .5rem;
    text-underline-offset: .22em;
    text-decoration-thickness: 1px;
  }
  a:hover { color: var(--mpt-text); }
  a:focus-visible, button:focus-visible {
    outline: 3px solid var(--mpt-sage);
    outline-offset: 5px;
    border-radius: 4px;
  }
  button { cursor: pointer; }
  ::selection { background: var(--mpt-violet); color: var(--mpt-ink); }
}

@layer components {
  .mpt-frame { width: min(100%, 1280px); margin-inline: auto; padding-inline: 40px; }
  .mpt-skip {
    position: absolute;
    top: 12px;
    left: 20px;
    z-index: 10;
    padding: 10px 18px;
    border-radius: 6px;
    background: var(--mpt-sage);
    color: var(--mpt-ink);
    transform: translateY(-170%);
  }
  .mpt-skip:focus { transform: translateY(0); color: var(--mpt-ink); }
  .mpt-masthead {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 32px;
    padding-bottom: 26px;
  }
  .mpt-masthead p { font-size: 18px; line-height: 1.25; font-weight: 610; }
  .mpt-masthead p span { display: block; color: var(--mpt-muted); font-size: 16px; font-weight: 420; margin-top: 4px; }
  .mpt-mark { width: 29px; height: 38px; border: 2px solid var(--mpt-violet); border-radius: 4px; position: relative; flex-shrink: 0; }
  .mpt-mark::after { content: ""; position: absolute; width: 23px; height: 32px; border: 2px solid var(--mpt-violet); border-radius: 4px; left: 5px; top: -5px; background: var(--mpt-ink); }
  .mpt-place { margin-left: auto; color: var(--mpt-muted); font-size: 16px; border: 1px solid var(--mpt-line); border-radius: 100px; padding: 6px 15px; }
  .mpt-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 50px; align-items: center; padding-top: 45px; padding-bottom: 76px; }
  .mpt-kicker { color: var(--mpt-violet); font-size: 16px; line-height: 1.5; margin-bottom: 22px; }
  .mpt-lead { color: var(--mpt-muted); font-size: 20px; line-height: 1.65; margin-top: 24px; max-width: 54ch; }
  .mpt-primary {
    padding: 14px 21px;
    background: var(--mpt-violet);
    color: var(--mpt-ink);
    border-radius: 9px;
    text-decoration: none;
    gap: 24px;
    font-weight: 610;
    line-height: 1.4;
    min-height: 52px;
    margin-top: 28px;
  }
  .mpt-primary:hover { background: var(--mpt-sage); color: var(--mpt-ink); }
  .mpt-page-heading { padding-block: 40px 58px; border-bottom: 1px solid var(--mpt-line); }
  .mpt-page-heading h1 { max-width: 20ch; }
  .mpt-page-heading .mpt-lead { max-width: 61ch; }
  .mpt-layout { display: grid; grid-template-columns: minmax(0, 1fr) 224px; gap: 48px; align-items: start; padding-top: 16px; }
  .mpt-article { min-width: 0; }
  .mpt-section { display: grid; grid-template-columns: minmax(0, 1fr) 160px; column-gap: 28px; padding-block: 42px; border-bottom: 1px solid var(--mpt-line); }
  .mpt-copy { min-width: 0; }
  .mpt-copy .mpt-section-heading { margin-bottom: 24px; }
  .mpt-copy > p + p { margin-top: 16px; }
  .mpt-margin { align-self: start; border-left: 2px solid var(--mpt-line); padding-left: 18px; margin-top: 7px; }
  .mpt-margin dt { color: var(--mpt-sage); font-size: 16px; font-weight: 650; line-height: 1.5; }
  .mpt-margin dd { color: var(--mpt-muted); font-size: 16px; line-height: 1.65; margin-top: 9px; }
  .mpt-label { display: block; color: var(--mpt-muted); font-size: 16px; line-height: 1.5; font-weight: 480; }
  .mpt-myth { margin-block: 0 24px; padding: 16px 20px; border-radius: 0 10px 10px 0; border-left: 3px solid var(--mpt-violet); background: var(--mpt-panel); }
  .mpt-myth p { margin-top: 6px; font-size: 18px; line-height: 1.6; }
  .mpt-source { margin-top: 20px; padding-top: 12px; border-top: 1px dotted var(--mpt-line); }
  .mpt-source + .mpt-source { border-top: 0; padding-top: 0; margin-top: 4px; }
  .mpt-source-label { color: var(--mpt-muted); font-size: 16px; display: block; }
  .mpt-source-link { font-size: 16px; line-height: 1.5; }
  .mpt-text-link { font-size: 18px; margin-top: 14px; line-height: 1.55; }
  .mpt-guide-rail { position: sticky; top: 24px; padding-top: 30px; min-width: 0; }
  .mpt-guide-label { color: var(--mpt-muted); font-size: 16px; line-height: 1.5; letter-spacing: 0; font-weight: 500; margin-bottom: 16px; }
  .mpt-guide-nav ul { list-style: none; }
  .mpt-guide-nav li + li { border-top: 1px solid var(--mpt-line); }
  .mpt-guide-nav a { display: flex; justify-content: space-between; min-height: 52px; padding: 10px 12px; font-size: 16px; text-decoration: none; line-height: 1.4; border-radius: 6px; }
  .mpt-guide-nav a span:last-child { margin-left: 8px; }
  .mpt-guide-nav a[aria-current="page"] { color: var(--mpt-text); background: var(--mpt-panel-raised); }
  .mpt-rail-note { color: var(--mpt-muted); font-size: 16px; line-height: 1.6; margin-top: 20px; padding-inline: 12px; }
  .mpt-list { list-style: none; margin-top: 20px; }
  .mpt-list li { padding: 14px 0 14px 24px; border-top: 1px dotted var(--mpt-line); font-size: 18px; position: relative; }
  .mpt-list li::before { content: ""; width: 6px; height: 6px; background: var(--mpt-sage); border-radius: 50%; position: absolute; left: 1px; top: 26px; }
  .mpt-next { display: grid; grid-template-columns: 1fr auto; padding: 24px; gap: 4px 20px; border-radius: var(--mpt-radius); border: 1px solid var(--mpt-line); background: var(--mpt-panel); text-decoration: none; margin-block: 36px 58px; min-height: 96px; }
  .mpt-next .mpt-label { grid-column: 1; }
  .mpt-next strong { font-size: 24px; font-weight: 580; line-height: 1.3; }
  .mpt-next > span:last-child { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 28px; }
  .mpt-illustration { background: var(--mpt-panel); border-radius: 18px; overflow: hidden; border: 1px solid var(--mpt-line); }
  .mpt-illustration img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; font-size: 16px; color: var(--mpt-muted); }
  .mpt-wide-art { margin-top: 32px; max-width: 660px; }
  .mpt-wide-art img { aspect-ratio: 5 / 3; }
  .mpt-footer { border-top: 1px solid var(--mpt-line); padding-top: 30px; padding-bottom: 40px; display: flex; justify-content: space-between; gap: 40px; }
  .mpt-footer p { max-width: 57ch; font-size: 16px; color: var(--mpt-muted); line-height: 1.7; }
  .mpt-footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; align-self: start; }
  .mpt-footer-links a { min-height: 44px; font-size: 16px; line-height: 1.5; }
  .mpt-anchor { scroll-margin-top: 24px; }
}

@layer utilities {
  @media (max-width: 1050px) {
    .mpt-frame { padding-inline: 30px; }
    .mpt-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .mpt-guide-rail { position: static; padding-block: 24px 48px; border-top: 1px solid var(--mpt-line); }
    .mpt-guide-nav ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
    .mpt-guide-nav li { border-top: 1px solid var(--mpt-line); }
    .mpt-hero { gap: 30px; }
    .mpt-footer { display: block; }
    .mpt-footer-links { margin-top: 18px; }
  }
  @media (max-width: 650px) {
    .mpt-frame { padding-inline: 20px; }
    .mpt-masthead { padding-top: 24px; padding-bottom: 24px; gap: 12px; }
    .mpt-place { padding: 5px 10px; }
    .mpt-hero { grid-template-columns: minmax(0, 1fr); padding-top: 20px; padding-bottom: 26px; gap: 34px; }
    .mpt-kicker { margin-bottom: 18px; }
    .mpt-lead { font-size: 18px; margin-top: 20px; }
    .mpt-primary { width: 100%; justify-content: space-between; }
    .mpt-page-heading { padding-block: 23px 34px; }
    .mpt-layout { padding-top: 0; }
    .mpt-section { grid-template-columns: minmax(0, 1fr); padding-block: 32px; }
    .mpt-margin { margin-top: 24px; max-width: 36ch; padding-left: 16px; }
    .mpt-margin dl { display: block; }
    .mpt-margin dd { margin-top: 6px; }
    .mpt-source-link { display: flex; }
    .mpt-next { padding: 20px; margin-block: 28px 36px; }
    .mpt-next strong { font-size: 22px; }
    .mpt-illustration { border-radius: 12px; }
    .mpt-guide-nav ul { gap: 0 12px; }
    .mpt-guide-nav a { padding-inline: 8px; min-height: 56px; }
    .mpt-guide-nav a span:last-child { display: none; }
    .mpt-footer { padding-top: 25px; padding-bottom: 28px; }
    .mpt-footer-links { gap: 6px 18px; }
  }
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  }
  @media print {
    :root { color-scheme: light; }
    body { background: white; color: black; }
    a, .mpt-lead, .mpt-label, .mpt-source-label, .mpt-kicker, .mpt-margin dt, .mpt-margin dd, .mpt-footer p { color: black; }
    .mpt-guide-rail, .mpt-footer-links, .mpt-skip, .mpt-illustration, .mpt-next, .mpt-compare-controls { display: none; }
    .mpt-layout { display: block; }
    .mpt-section { break-inside: avoid; }
    .mpt-myth, .mpt-setting { background: white; }
  }
}
