/* ---------------------------------------------------------------------------
   What the portfolio adds on top of the Home Base look.

   Home Base's cards are glanceable: one big number, one line under it, and the
   whole card is a click target. This page has the opposite job — a visitor
   arrives knowing nothing and has to be able to READ. So the same cards grow a
   prose block, the numbers shrink to make room for it, and the whole-card click
   target is removed, because on a card with three paragraphs the first thing a
   stretched link does is navigate away while someone is trying to select text.

   Loaded after components.css and only overrides; the shared files stay
   byte-identical to Home Base's so a fix there can be copied across.
--------------------------------------------------------------------------- */

/* ---- Masthead ---------------------------------------------------------- */

.masthead-title {
  /* A name is longer than "HEJ PETER!" and must not wrap mid-word on a phone. */
  font-size: clamp(26px, 4.6vw, 46px);
}

/* Three things on the right now, not two. Wrap rather than squeeze — the CV
   button dropping to its own line is fine, it shrinking is not.
   margin-left:auto rather than the row's space-between: once the group wraps
   onto its own line it is the only item there, and space-between parks a lone
   item at the start. The auto margin keeps it on the right either way. */
.masthead-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px 14px;
  margin-left: auto;
}

/* The CV button.
   The one thing on this page that is not an app, so it is not a card — it is
   the masthead's call to action.

   Yellow rather than a fifth hue: it is already the page's action colour (the
   → IDEA button) and the colour of the star in the title and the favicon, so it
   reads as "the button here" instead of as a new category. It is deliberately
   heavier than the theme toggle sitting next to it — same family, more weight,
   so the eye picks the right one. */
.cv-button {
  background: var(--yellow);
  color: var(--ink-on-yellow);
  border: 4px solid var(--ink);
  box-shadow: 7px 7px 0 var(--shadow-ink);
  padding: 14px 28px;
  /* Sentence case, and no letter-spacing. Everything else in the masthead is
     tracked-out uppercase, so a normal-cased phrase reads as speech rather than
     as another label — which is the point of a call to action. */
  font-size: clamp(17px, 1.9vw, 22px);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.cv-button:hover {
  translate: -2px -2px;
  box-shadow: 10px 10px 0 var(--shadow-ink);
}

.cv-button:active {
  translate: 6px 6px;
  box-shadow: none;
}

/* The rule that used to sit on .summary, moved up onto the row.

   It cannot live on .masthead-note: that has a 62ch max-width so the prose does
   not run the full width of a wide screen, and a border on it stops dead
   halfway across the masthead. The row spans the block, so the rule does too. */
.masthead-row {
  padding-bottom: 14px;
  border-bottom: var(--border-w) solid var(--ink);
}

.masthead-note {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  max-width: 62ch;
}

/* ---- Badges ------------------------------------------------------------ */

/* Three states, three colours, stated once in the legend and then reused on
   every card. The badge is what stops a visitor wondering whether the thing
   they are looking at is real. */
.badge {
  display: inline-block;
  border: 2px solid currentColor;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  white-space: nowrap;
  vertical-align: 1px;
}

.badge-demo {
  background: var(--yellow);
  color: var(--ink-on-yellow);
  border-color: #000;
}

.badge-live {
  background: var(--green);
  color: var(--ink-on-green);
  border-color: #000;
}

.badge-closed {
  background: var(--paper);
  color: var(--ink);
  border-color: currentColor;
}

/* ---- Legend ------------------------------------------------------------ */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  padding: 12px 20px;
}

.legend-item {
  font-size: 13px;
  font-weight: 600;
}

/* ---- Cards ------------------------------------------------------------- */

.grid {
  /* Wider than Home Base's 250px: these cards hold paragraphs, and a 250px
     column turns every sentence into four ragged lines. */
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  /* Stretch, not start: the cards hold different amounts of prose, and letting
     each one end where its text ends leaves a row of blocks with ragged
     bottoms. Equal-height rows read as a grid; ragged ones read as a mistake.
     The OPEN → link is already pushed down by margin-top:auto, so the extra
     height lands as space above the link rather than a gap in the middle. */
  align-items: stretch;
}

.card {
  min-height: 0;
  gap: 4px;
}

/* The number is still the first thing you see, but it is no longer the whole
   card, so it gives back most of its size. */
.card-value {
  font-size: clamp(30px, 3.4vw, 38px);
}

/* Label and badge travel together on the left; anything with its own click, so
   far only the ⟳ shuffle, stays on the right. */
.card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* The whole explainer, now. One sentence, separated from the live numbers by a
   rule so the card reads as "what is happening" then "what this is". */
.card-what {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 700;
}

/* The stretched click target from components.css is kept, not killed. It was
   removed while the cards held three paragraphs, because a card-wide link
   hijacks text selection. With one sentence there is nothing to select. */
.card-link {
  margin-top: 14px;
  border-bottom-width: 3px;
}

/* Podscript's OPEN → is a <button>, since it opens a dialog rather than going
   anywhere. Strip the UA button styling so it is the same object as the links. */
button.card-link {
  background: none;
  border: none;
  border-bottom: 3px solid currentColor;
  padding: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

/* ---- Podscript dialog --------------------------------------------------- */

/* Same block vocabulary as everything else: thick border, hard shadow, nothing
   eases. A native <dialog>, so Esc, the backdrop click and focus trapping come
   from the platform rather than from script. */
.modal {
  border: var(--border-w) solid var(--ink);
  box-shadow: var(--shadow);
  background: var(--paper);
  color: var(--ink);
  max-width: min(560px, calc(100vw - 32px));
  padding: 0;
  /* A modal <dialog> is centred by the UA's own `margin: auto`, which the
     `* { margin: 0 }` reset in base.css wipes out. Put it back, or it opens
     pinned to the top-left corner. */
  margin: auto;
}

.modal::backdrop {
  background: rgb(0 0 0 / 62%);
}

.modal-inner {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 14.5px;
  line-height: 1.55;
}

.modal-top {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: var(--border-w) solid var(--ink);
  padding-bottom: 12px;
}

.modal-title {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.modal-stack {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  border-top: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  padding-top: 12px;
}

.modal-close {
  align-self: flex-start;
  background: var(--yellow);
  color: var(--ink-on-yellow);
  border: var(--border-w) solid var(--ink);
  box-shadow: 4px 4px 0 var(--shadow-ink);
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.modal-close:hover {
  translate: -1px -1px;
  box-shadow: 5px 5px 0 var(--shadow-ink);
}

.modal-close:active {
  translate: 4px 4px;
  box-shadow: none;
}

/* ---- Capture ----------------------------------------------------------- */

.capture-hint {
  margin: -2px 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  max-width: 68ch;
}

/* ---- Footer ------------------------------------------------------------ */

.foot a {
  color: inherit;
}

/* ---- Small screens ----------------------------------------------------- */

@media (max-width: 560px) {
  .card-value {
    font-size: 30px;
  }

  .legend {
    flex-direction: column;
    gap: 6px;
  }

  /* On a phone the meta row sits under the name and reads left-to-right with
     it, rather than hanging off the right edge of nothing. */
  .masthead-meta {
    justify-content: flex-start;
  }

  /* "my CV →" survives on its own once the button is the only yellow thing on
     screen, and dropping the lead-in keeps it from wrapping on a phone. */
  .cv-button-ext {
    display: none;
  }

  .cv-button {
    padding: 12px 22px;
  }
}
