/*
 * Shared site styles.
 *
 * Canonical for all six pages. Per-page theme colors (--accent, --blue,
 * etc. on case-study pages other than homemade) are overridden in a small
 * inline <style> block in that page's own <head> — see README.md.
 */
  :root {
    --bg: #F2F2F1;
    --ink: #1A1917;
    --muted: #6E6E6C;
    --line: #E2E2E0;
    --accent: #35734C;
    --accent-soft: #E4EDE7;
    --blue: #35734C;
    --blue-soft: #E4EDE7;
    --sidebar-bg: #F8F8F7;
    --card: #FFFFFF;
    --serif: 'Source Serif 4', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;
  }

  * { box-sizing: border-box; }

  p, li, .case-header .dek, .pull-quote, .decision-block p, .evidence-item p {
    text-wrap: pretty;
  }

  body {
    margin: 0;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
  }

  a { color: inherit; text-decoration: none; }

  /* ---- Skip link ----
     First focusable element on the page. The nav sits before the content in
     the DOM, so without this a keyboard user tabs through 11 links before
     reaching the article on every page. Off-screen until focused. ---- */
  .skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--accent);
    border-radius: 6px;
    font-size: 14px;
    transition: top 0.15s ease;
  }
  .skip-link:focus { top: 8px; outline: 2px solid var(--accent); outline-offset: 2px; }
  @media (prefers-reduced-motion: reduce) { .skip-link { transition: none; } }

  /* ---- Focus states ----
     The hero tiles and the read toggle already had these; the navigation that
     appears on every page did not, and the browser default is close to
     invisible against these panels. ---- */
  .nav-card:focus-visible,
  .back-link:focus-visible,
  .identity .home-link:focus-visible,
  .identity .link:focus-visible,
  .sidebar-footer a:focus-visible,
  .case-content a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
  }

  .shell {
    display: flex;
    min-height: 100vh;
  }

  /* ---- Fixed sidebar ---- */
  .sidebar {
    width: 320px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--sidebar-bg);
    padding: 32px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  /* The column that .sidebar-footer's margin-top:auto pushes against. The
     footer is nested inside this wrapper (which exists so the mobile bar can
     collapse everything below it), so the wrapper — not .sidebar — has to be
     the full-height flex context. */
  .sidebar-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  /* Was an <h1> wrapping a link. The page title is the h1 now, so this is a
     plain link and carries the type itself. */
  .identity .home-link {
    display: block;
    font-family: var(--serif);
    font-weight: 500;
    font-size: 22px;
    line-height: 1.2;
    margin: 0 0 12px;
    transition: color 0.15s;
  }
  .identity .home-link:hover { color: var(--accent); }
  .identity p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--muted);
    margin: 0 0 8px;
  }
  .identity .link {
    display: block;
    width: fit-content;
    font-size: 14px;
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
    margin-bottom: 8px;
  }
  .header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 16px;
    margin-bottom: 16px;
  }
  .back-link {
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    transition: color 0.15s;
  }
  .back-link:hover {
    color: var(--accent);
  }

  .sidebar-section {
    margin-top: 36px;
  }
  .sidebar-section .heading {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 14px;
  }

  .nav-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 10px;
    background: var(--card);
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .nav-card:hover { border-color: var(--blue); }
  .nav-card.active { border-color: var(--blue); border-width: 2px; background: var(--card); }
  .nav-card.disabled { opacity: 0.45; cursor: default; }

  .nav-card .swatch {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 15px;
    color: #fff;
  }

  .nav-card .info .name {
    font-size: 14px;
    font-weight: 600;
  }
  .nav-card .info .tag {
    font-size: 12px;
    color: var(--muted);
  }

  .coming-soon-tag {
    font-family: var(--mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--line);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
    color: var(--muted);
  }

  .sidebar-footer {
    margin-top: auto;
    padding-top: 24px;
    font-size: 12px;
    color: var(--muted);
  }
  .sidebar-footer a { color: var(--accent); }

  /* ---- Scrolling content ---- */
  .content-area {
    flex: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--sidebar-bg);
  }

  .content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 10px 10px 10px 0;
    background: #FFFFFF;
    border-radius: 10px;
    border: 1px solid var(--line);
    overflow: hidden;
  }

  .scroll-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .breadcrumb-bar a.crumb {
    color: var(--muted);
    padding: 14px 0;
    font-size: 12px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
  }
  .breadcrumb-bar a.crumb:hover { color: var(--ink); }
  .breadcrumb-bar a.crumb.active { color: var(--accent); font-weight: 600; }
  .breadcrumb-bar .chevron {
    color: var(--line);
    font-size: 13px;
    margin: 0 12px;
    flex-shrink: 0;
  }
  .case-header {
    padding: 64px 56px 48px;
  }
  .case-header .eyebrow {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }
  .case-header h1 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.1;
    margin: 0 0 18px;
  }
  .case-header .dek {
    font-size: 17px;
    color: var(--muted);
    margin: 0 0 36px;
  }

  .meta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
  }
  .meta-item .label {
    font-family: var(--mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 6px;
  }
  .meta-item .value { font-size: 14px; }

  /* Reading-length switch. Two real pages rather than an accordion, so the
     case study stays one continuous argument in whichever length you pick. */
  .read-toggle {
    display: inline-flex;
    align-items: stretch;
    margin-top: 26px;
    border: 1px solid var(--line);
    border-radius: 100px;
    overflow: hidden;
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.02em;
  }
  .read-toggle > * { padding: 8px 16px; white-space: nowrap; }
  .read-toggle .rt-on {
    background: var(--accent);
    color: #FFFFFF;
  }
  .read-toggle .rt-off {
    color: var(--muted);
    text-decoration: none;
    transition: background 0.16s ease, color 0.16s ease;
  }
  .read-toggle .rt-off:hover { background: var(--accent-soft); color: var(--accent); }
  .read-toggle .rt-off:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

  .hero-image { padding: 0 56px 64px; }
  /* height:auto is required now that every <img> carries real width/height
     attributes: without it the attribute's height wins over the CSS width
     and the image renders at its intrinsic pixel height. */
  .hero-image img { width: 100%; border-radius: 4px; border: 1px solid var(--line); display: block;
    height: auto;
  }

  .case-content { padding: 0 56px 120px; }

  /* Sections are chaptered by a hairline so the page chunks visibly when
     skimmed. h3/h4 are sized so each level clears the one below it —
     h4 previously sat under the body size and read as a bold sentence. */
  .case-content section {
    margin-bottom: 56px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
  }
  .case-content section:first-child { padding-top: 0; border-top: none; }
  .case-content h3 {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 30px;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 18px;
  }
  .case-content h4 {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.35;
    margin: 34px 0 10px;
  }
  .case-content p { font-size: 15.5px; margin: 0 0 16px; }
  .case-content ul { padding-left: 20px; }
  .case-content li { margin-bottom: 8px; font-size: 15.5px; }

  .pull-quote {
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    line-height: 1.5;
    border-left: 3px solid var(--blue);
    padding: 2px 0 2px 20px;
    margin: 24px 0;
  }
  .pull-quote cite {
    display: block;
    font-family: var(--mono);
    font-style: normal;
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
  }

  .quote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 22px 0; }
  .quote-grid .pull-quote { margin: 0; }
  @media (max-width: 700px) { .quote-grid { grid-template-columns: 1fr; } }

  /* An aside whose label sits out in the margin beside the text, so a
     reader can scan the labels down the page as a spine of arguments.
     Paragraphs are pushed to column 2 in CSS so the markup stays flat. */
  .decision-block {
    display: grid;
    grid-template-columns: 168px 1fr;
    column-gap: 28px;
    margin: 30px 0;
    padding: 20px 0 4px;
    border-top: 1px solid var(--line);
  }
  .decision-block .tag {
    grid-column: 1;
    grid-row: 1;
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: 0;
    color: var(--blue);
    padding-top: 1px;
  }
  .decision-block p { grid-column: 2; }
  .decision-block p:last-child { margin-bottom: 0; }
  @media (max-width: 700px) {
    .decision-block { grid-template-columns: 1fr; }
    .decision-block .tag { grid-column: 1; margin-bottom: 10px; }
    .decision-block p { grid-column: 1; }
  }

  .evidence-item { display: grid; grid-template-columns: 28px 1fr; gap: 14px; margin-bottom: 18px; }
  .evidence-item .num { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--blue); }
  .evidence-item p { margin: 0; }

  .img-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin: 28px 0; }
  @media (max-width: 800px) { .img-row { grid-template-columns: 1fr; } }
  .img-row img { width: 100%; border-radius: 4px; border: 1px solid var(--line);
    height: auto;
  }
  .img-row .cap { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; }

  figure { margin: 28px 0; }
  figure img {
    width: 100%;
    height: auto;
    /* Several exports are portrait enough to render over 900px tall in this
       column - one hit 1,176px, taller than most viewports, so it filled the
       screen and broke the reading rhythm. Capping the height and letting the
       width follow keeps a figure to something you can take in at a glance. */
    max-height: 640px;
    width: auto;
    max-width: 100%;
    margin-inline: auto;
    border-radius: 4px;
    border: 1px solid var(--line);
    display: block;
  }
  /* Paired images share a row and are already half-width; letting them size
     independently would leave the pair visibly mismatched. */
  figure:has(img + img) img { width: 100%; max-height: none; }
  figure:has(img + img) { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  /* Opt out of the 2-up grid where images are wide banners or full pages
     that become unreadable at half width. */
  figure.stacked { display: flex; flex-direction: column; gap: 14px; }
  figure:has(img + img) figcaption { grid-column: 1 / -1; }
  @media (max-width: 700px) { figure:has(img + img) { grid-template-columns: 1fr; } }
  figcaption { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 8px; }

  .lessons-list { list-style: none; padding: 0; }
  .lessons-list li { padding: 16px 0; border-top: 1px solid var(--line); font-size: 15.5px; }

  /* ---- Role entries (work-experience.html) ---- */
  .role + .role {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid var(--line);
  }
  .role-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 16px;
  }
  .role-header h4 { margin: 0; font-size: 17px; }
  .role-dates {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    white-space: nowrap;
  }
  .role-location { font-size: 13px; color: var(--muted); margin: 4px 0 16px; }
  .role ul { margin: 0; }

  /* ---- Label/value list (work-experience.html core competencies) ---- */
  .skills-list { margin: 0; }
  .skills-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 8px 24px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
  }
  .skills-row:first-child { border-top: none; padding-top: 0; }
  .skills-row dt {
    font-family: var(--mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
  }
  .skills-row dd { margin: 0; font-size: 15.5px; }

  /* Links out to the case study for a role, where one exists. */
  .role-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    margin: 18px 0 0;
  }
  .role-links .link { margin-bottom: 0; }
  @media (max-width: 700px) {
    .skills-row { grid-template-columns: 1fr; gap: 4px; }
  }

  .mockup-note {
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--muted);
    background: var(--accent-soft);
    padding: 12px 18px;
    border-radius: 4px;
    margin: 0 56px 40px;
  }

  /* ---- Compact bar shown only once the sidebar collapses (see
     assets/js/mobile-nav.js). Hidden at every width where the full
     sidebar is on screen. ---- */
  .mobile-bar { display: none; }

  @media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar {
      width: 100%; height: auto; position: static;
      border-right: none; border-bottom: 1px solid var(--line);
      padding: 0;
    }
    .content-area { height: auto; }
    .case-header, .hero-image, .case-content { padding-left: 24px; padding-right: 24px; }
    .mockup-note { margin-left: 24px; margin-right: 24px; }

    /* The panel's left margin is 0 on desktop so it sits flush against the
       sidebar. Once the sidebar moves above it, that reads as the card
       falling off the left edge while the right keeps its inset. */
    .content-panel { margin: 10px; }

    .sidebar-body { padding: 24px 35px 28px; }

    /* Only collapse once the script has confirmed it can also reopen it. */
    .sidebar.has-mobile-nav .mobile-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      padding: 0 35px;
      min-height: 56px;
      background: var(--sidebar-bg);
    }
    .sidebar.has-mobile-nav .sidebar-body { display: none; }
    .sidebar.has-mobile-nav.nav-open .sidebar-body { display: block; }

    .mb-home {
      font-family: var(--serif);
      font-size: 19px;
      font-weight: 500;
      color: var(--ink);
      text-decoration: none;
      /* Fills the bar height so the tap target clears 44px without
         padding the visible text away from the baseline. */
      display: flex;
      align-items: center;
      align-self: stretch;
      transition: color 0.15s;
    }
    .mb-home:hover { color: var(--accent); }
    .mb-home:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
      border-radius: 4px;
    }
    .mb-toggle {
      display: flex;
      align-items: center;
      gap: 9px;
      align-self: stretch;
      padding: 0 4px 0 12px;
      min-height: 44px;
      background: none;
      border: 0;
      cursor: pointer;
      font-family: var(--mono);
      font-size: 12px;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted);
    }
    .mb-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
    .mb-toggle-icon {
      width: 16px; height: 2px;
      background: currentColor;
      position: relative;
    }
    .mb-toggle-icon::before,
    .mb-toggle-icon::after {
      content: ""; position: absolute; left: 0;
      width: 16px; height: 2px; background: currentColor;
    }
    .mb-toggle-icon::before { top: -5px; }
    .mb-toggle-icon::after  { top: 5px; }
    .nav-open .mb-toggle-icon { background: transparent; }
    .nav-open .mb-toggle-icon::before { top: 0; transform: rotate(45deg); }
    .nav-open .mb-toggle-icon::after  { top: 0; transform: rotate(-45deg); }

    /* The bar already carries the name, so the identity block would show it
       twice over the moment the panel opens. */
    .sidebar.has-mobile-nav .identity .home-link { display: none; }
    .sidebar.has-mobile-nav .identity { padding-top: 4px; }

    /* ---- Touch targets. These sit at 15-23px tall on desktop, which is
       fine for a cursor and too small for a thumb. ---- */
    .sidebar-footer { line-height: 2.4; }
    .sidebar-footer a { display: inline-block; padding: 4px 0; }
    .identity .link { display: inline-block; padding: 6px 0; }
    .back-link { display: inline-block; padding: 8px 0; }

    /* 11px captions are legible on a desktop monitor and not on a phone. */
    figure figcaption { font-size: 12.5px; }
    .eyebrow, .nav-card .tag { font-size: 12.5px; }
  }

  /* ---- Inline SVG diagrams (figure > svg). Inert unless the pattern exists. ---- */
  figure.diagram {
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 26px 22px 16px;
    overflow-x: auto;
  }
  figure.diagram svg { width: 100%; min-width: 520px; height: auto; display: block; }
  @media (max-width: 700px) {
    figure.diagram { padding: 18px 14px 12px; }
    /* Below the SVG's own floor the figure becomes a horizontal scroller.
       Say so, rather than leaving it looking like a cropped image. */
    figure.diagram::before {
      content: "Scroll to see the full diagram →";
      display: block;
      position: sticky;
      left: 0;
      margin-bottom: 12px;
      font-family: var(--mono);
      font-size: 11.5px;
      color: var(--muted);
    }
  }
  figure.diagram figcaption { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); line-height: 1.6; }
  .dgm-label { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: currentColor; }
  .dgm-sub   { font-family: var(--sans); font-size: 11.5px; fill: currentColor; opacity: 0.6; }
  .dgm-edge  { font-family: var(--mono); font-size: 11px; fill: currentColor; opacity: 0.7; }
  .dgm-accent{ font-family: var(--mono); font-size: 11px; fill: var(--accent); }
  .dgm-head  { font-family: var(--mono); font-size: 10px; letter-spacing: 0.09em; fill: currentColor; opacity: 0.55; }
  .dgm-box   { fill: none; stroke: currentColor; stroke-width: 1.25; opacity: 0.85; }
  .dgm-flow  { stroke: currentColor; stroke-width: 1.25; fill: none; opacity: 0.7; }
  .dgm-flow-a{ stroke: var(--accent); stroke-width: 1.75; fill: none; }
  .dgm-fill-a{ fill: var(--accent); }
  .dgm-stroke-a{ stroke: var(--accent); }

  /* Paired with assets/js/protect-images.js — suppresses the long-press save
     sheet on iOS and the drag ghost. Friction only; see that file. */
  img {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
  }
