/* ==========================================================================
   components.css — Reusable UI: buttons, pills, cards, credential band,
   topic list, forms, modal, toast, reveal, back-to-top
   ========================================================================== */

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  --btn-bg: var(--surface-raised);
  --btn-fg: var(--text);
  --btn-border: var(--line-strong);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.8em 1.4em;
  border: 1px solid var(--btn-border);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease),
    background-color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease), opacity var(--dur-fast) var(--ease);
}

.btn:hover {
  color: var(--btn-fg);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

/* Variants ---------------------------------------------------------------- */

/* White text sits on both gradient stops at >= 4.9:1. */
.btn--primary {
  background: var(--grad-brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px -14px rgb(var(--brand-deep-rgb) / 0.35);
}

.btn--primary:hover {
  background: var(--grad-brand-hover);
  box-shadow: 0 14px 30px -16px rgb(var(--brand-deep-rgb) / 0.3);
}

.btn--secondary {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-border: var(--line-strong);
}

.btn--secondary:hover {
  --btn-border: var(--blue-600);
  background: rgb(var(--brand-rgb) / 0.08);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-soft);
  --btn-border: transparent;
}

.btn--ghost:hover {
  --btn-fg: var(--text);
  background: rgb(var(--ink-rgb) / 0.05);
}

.btn--sm {
  padding: 0.58em 1.05em;
  font-size: var(--fs-xs);
}

.btn--lg {
  padding: 0.95em 1.75em;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn__icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease-out);
}

.btn:hover .btn__icon--arrow {
  transform: translateX(3px);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* Text link with arrow */

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  color: var(--brand);
}

.link-arrow::after {
  content: "\2192";
  transition: transform var(--dur) var(--ease-out);
}

.link-arrow:hover::after {
  transform: translateX(4px);
}

/* ==========================================================================
   Pills / badges
   ========================================================================== */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.35em 0.85em;
  border: 1px solid rgb(var(--brand-rgb) / 0.32);
  border-radius: var(--r-pill);
  background: rgb(var(--brand-rgb) / 0.08);
  color: var(--blue-700);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* The single warm note on the site. */
.pill--soon {
  border-color: rgb(var(--accent-rgb) / 0.4);
  background: rgb(var(--accent-rgb) / 0.12);
  color: var(--accent-700);
}

.pill__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(1.4rem, 1.2rem + 0.9vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease), transform var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease);
}

.card--hover:hover {
  transform: translateY(-3px);
  border-color: rgb(var(--brand-rgb) / 0.34);
  background: var(--surface-raised);
  box-shadow: var(--sh-md);
}

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.card__title {
  font-size: var(--fs-h3);
}

.card__body {
  margin-top: var(--sp-3);
  color: var(--text-soft);
  line-height: var(--lh-loose);
}

.card__body > * + * {
  margin-top: var(--sp-3);
}

.card__foot {
  margin-top: auto;
  padding-top: var(--sp-5);
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--sp-4);
  border: 1px solid rgb(var(--brand-rgb) / 0.26);
  border-radius: var(--r-md);
  background: rgb(var(--brand-rgb) / 0.08);
  color: var(--blue-700);
}

.card__icon svg {
  width: 22px;
  height: 22px;
}

/* ==========================================================================
   Reason list — a bold lead-in over its supporting sentence
   ========================================================================== */

.reason {
  position: relative;
  padding-left: var(--sp-5);
}

.reason::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--blue-600), rgb(var(--brand-rgb) / 0.12));
}

.reason__title {
  margin-bottom: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-h4);
  font-weight: 640;
  color: var(--heading);
}

.reason__text {
  color: var(--text-soft);
  line-height: var(--lh-loose);
}

/* ==========================================================================
   Credential band — institution crest paired with its wordmark

   These marks are dark ink on transparent, so each pair sits on a faint
   blue pad rather than bare white. That keeps every brand legible and
   correct instead of recolouring artwork that is not ours to alter.
   ========================================================================== */

.credential-band {
  --crest-size: 46px;
  --logo-w: 104px;
}

.credential-band__label {
  margin-bottom: var(--sp-5);
  font-size: var(--fs-xs);
  font-weight: 620;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  text-align: center;
}

.credential-band__track {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.5rem, 0.3rem + 0.8vw, 0.9rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.credential-band__track > li + li {
  margin-top: 0;
}

.credential {
  display: flex;
  align-items: center;
  gap: clamp(0.55rem, 0.4rem + 0.5vw, 0.9rem);
  height: 100%;
  padding: 0.75rem clamp(0.85rem, 0.6rem + 0.7vw, 1.2rem);
  border: 1px solid rgb(var(--ink-rgb) / 0.08);
  border-radius: var(--r-md);
  background: var(--chip);
  transition: transform var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease);
}

.credential:hover {
  transform: translateY(-2px);
  border-color: var(--blue-600);
}

.credential__crest,
.credential__logo {
  object-fit: contain;
}

.credential__crest {
  width: var(--crest-size);
  height: var(--crest-size);
  flex-shrink: 0;
}

.credential__rule {
  width: 1px;
  align-self: stretch;
  margin-block: 0.3rem;
  background: rgb(var(--ink-rgb) / 0.16);
}

/* max-width + max-height lets the browser fit each mark to whichever axis
   binds first, so wordmarks and tall shields land on one optical baseline. */
.credential__logo {
  width: auto;
  height: auto;
  max-width: var(--logo-w);
  max-height: calc(var(--crest-size) - 6px);
}

/* Per-institution optical balancing: the marks have very different ratios. */
.credential--evcc {
  --logo-w: 124px;
}

.credential--bu,
.credential--ewu {
  --logo-w: 78px;
}

/* Both of these are tall letterforms rather than wordmarks, so they are
   held by height and given a narrower box than the wide marks above. */
.credential--lasell {
  --logo-w: 42px;
}

.credential--emerson {
  --logo-w: 52px;
}

@media (max-width: 620px) {
  .credential-band {
    --crest-size: 40px;
    --logo-w: 92px;
  }

  .credential-band__track {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: var(--sp-3);
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .credential {
    flex-shrink: 0;
    scroll-snap-align: center;
  }
}

/* ==========================================================================
   Credential rows (About page education list)
   ========================================================================== */

.credentials__group {
  margin-bottom: var(--sp-4);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 620;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.credentials + .credentials__group {
  margin-top: var(--sp-7);
}

.credentials {
  display: grid;
  gap: var(--sp-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.credentials > li + li {
  margin-top: 0;
}

.credential-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(1rem, 0.6rem + 1.5vw, 1.75rem);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.credential-row:hover {
  border-color: rgb(var(--brand-rgb) / 0.34);
  background: var(--surface-raised);
  box-shadow: var(--sh-sm);
}

.credential-row__marks {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  width: 132px;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-sm);
  background: var(--chip);
}

.credential-row__crest {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.credential-row__logo {
  width: auto;
  height: auto;
  max-width: 68px;
  max-height: 36px;
  object-fit: contain;
}

.credential-row__school {
  font-size: var(--fs-xs);
  font-weight: 620;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-700);
}

.credential-row__degree {
  margin-top: 0.3rem;
  font-family: var(--font-body);
  font-size: var(--fs-h4);
  font-weight: 640;
  color: var(--heading);
  line-height: var(--lh-snug);
}

.credential-row__note {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: var(--lh-body);
}

/* Dates sit in their own column so every row lines up down the right edge.
   Tabular figures keep the digits on a common grid. */
.credential-row__dates {
  align-self: center;
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-mute);
}

.credential-row__dates--current {
  color: var(--blue-700);
}

@media (max-width: 720px) {
  .credential-row {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: var(--sp-3);
  }

  .credential-row__dates {
    grid-column: 2;
    margin-top: -0.35rem;
  }
}

@media (max-width: 560px) {
  .credential-row {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }

  .credential-row__marks {
    width: max-content;
  }

  .credential-row__dates {
    grid-column: 1;
    margin-top: -0.5rem;
  }
}

/* ==========================================================================
   Checklist
   ========================================================================== */

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

.checklist li {
  position: relative;
  padding-left: 1.9rem;
  color: var(--text-soft);
  line-height: var(--lh-loose);
}

.checklist li + li {
  margin-top: var(--sp-4);
}

.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: rgb(var(--brand-rgb) / 0.14)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%230f6699'%3E%3Cpath d='M8.1 13.6 4.8 10.3l1.2-1.2 2.1 2.1 5.9-5.9 1.2 1.2z'/%3E%3C/svg%3E")
    center / 100% no-repeat;
}

/* ==========================================================================
   Topic list (workshop topics)
   ========================================================================== */

.topics {
  display: grid;
  gap: var(--sp-3);
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: topic;
}

.topics > li + li {
  margin-top: 0;
}

.topic {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--sp-4);
  padding: clamp(1.1rem, 1rem + 0.5vw, 1.5rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  transition: border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.topic:hover {
  border-color: rgb(var(--brand-rgb) / 0.34);
  background: var(--surface-raised);
}

.topic__index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgb(var(--brand-rgb) / 0.3);
  background: rgb(var(--brand-rgb) / 0.08);
  font-size: 0.78rem;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  color: var(--blue-700);
}

.topic__title {
  margin-bottom: var(--sp-2);
}

.topic__desc {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
}

/* ==========================================================================
   Quote / callout
   ========================================================================== */

.callout {
  position: relative;
  padding: clamp(1.4rem, 1.2rem + 1vw, 2.1rem);
  border-radius: var(--r-lg);
  border: 1px solid rgb(var(--brand-rgb) / 0.22);
  background: linear-gradient(140deg, rgb(var(--brand-rgb) / 0.1), rgb(var(--brand-rgb) / 0.03));
}

.callout__quote {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  line-height: 1.4;
  color: var(--heading);
}

.callout__cite {
  display: block;
  margin-top: var(--sp-4);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-style: normal;
  font-weight: 600;
  color: var(--blue-700);
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form {
  display: grid;
  gap: var(--sp-5);
}

.form__grid {
  display: grid;
  gap: var(--sp-5);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}

.field__req {
  color: var(--accent-700);
  margin-left: 0.15em;
}

.field__hint {
  font-size: var(--fs-xs);
  color: var(--text-mute);
  line-height: 1.5;
}

.field__control {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--n-850);
  color: var(--text);
  font-size: var(--fs-sm);
  line-height: 1.5;
  transition: border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.field__control::placeholder {
  color: var(--text-mute);
}

.field__control:hover {
  border-color: rgb(var(--brand-rgb) / 0.4);
}

.field__control:focus,
.field__control:focus-visible {
  outline: none;
  background: var(--n-900);
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / 0.18);
}

textarea.field__control {
  min-height: 140px;
  resize: vertical;
}

select.field__control {
  appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%235f7484'%3E%3Cpath d='M5.5 7.5 10 12l4.5-4.5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 18px;
}

/* The native option list is painted by the OS, so set both sides. This is
   the no-JS fallback; where JS runs, .select below replaces it entirely. */
select.field__control option {
  background: var(--n-800);
  color: var(--text);
}

/* ==========================================================================
   Select — themed dropdown

   A native option list is drawn by the operating system, so it lands as a
   pale system menu in the middle of a dim page and ignores every token here.
   Where scripting is available the native control is hidden and this listbox
   is drawn from the same <option> elements. The real <select> stays in the
   DOM and keeps holding the value, so validation and submission are
   untouched, and without JS the native control simply remains visible.
   ========================================================================== */

.select {
  position: relative;
}

/* Kept in the layer for form APIs and focus forwarding, never seen. */
.select__native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.select__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--n-850);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
}

.select__button:hover {
  border-color: rgb(var(--brand-rgb) / 0.4);
}

.select__button:focus-visible {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / 0.18);
}

.select.is-open .select__button {
  background: var(--n-900);
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgb(var(--brand-rgb) / 0.18);
}

/* width:0 + flex-grow is load-bearing, not cosmetic. Without it this item
   contributes the full nowrap width of the longest option as the field's
   minimum size; that propagates up through .field -> .form__grid -> .form
   -> the page grid, and puts the whole contact page into horizontal scroll
   on a phone. Pinned at zero, the item grows into whatever space exists and
   the ellipsis does the rest. */
.select__value {
  flex: 1 1 auto;
  width: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select__caret {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text-mute);
  transition: transform var(--dur) var(--ease), color var(--dur-fast) var(--ease);
}

.select__button:hover .select__caret,
.select.is-open .select__caret {
  color: var(--blue-700);
}

.select.is-open .select__caret {
  transform: rotate(180deg);
}

.select__menu {
  position: absolute;
  z-index: var(--z-overlay);
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: 15rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-md);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}

.select__menu[hidden] {
  display: none;
}

.select__menu > li + li {
  margin-top: 2px;
}

.select.is-open .select__menu {
  opacity: 1;
  transform: none;
}

/* Drops upward when the field sits near the bottom of the viewport. */
.select--up .select__menu {
  top: auto;
  bottom: calc(100% + 6px);
  transform: translateY(4px);
}

.select__option {
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-xs);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.45;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.select__option.is-active {
  background: var(--surface-raised);
  color: var(--text);
}

.select__option[aria-selected="true"] {
  background: rgb(var(--brand-rgb) / 0.14);
  color: var(--blue-900);
  font-weight: 600;
}

.field.is-invalid .select__button {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgb(var(--danger-rgb) / 0.09);
}

@media (prefers-reduced-motion: reduce) {
  .select__menu,
  .select__caret {
    transition: none;
  }
}

/* Validation state */

.field.is-invalid .field__control {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgb(var(--danger-rgb) / 0.09);
}

.field__error {
  font-size: var(--fs-xs);
  font-weight: 550;
  color: var(--danger);
}

.field__error:empty {
  display: none;
}

/* Checkbox / radio */

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  line-height: 1.55;
  cursor: pointer;
}

.choice input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.2rem;
  accent-color: var(--blue-500);
  flex-shrink: 0;
  cursor: pointer;
}

.choice:hover {
  color: var(--text);
}

.choice-group {
  display: grid;
  gap: var(--sp-3);
}

/* Honeypot — off-screen, never focusable by keyboard */

.form__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4);
}

.form__status {
  font-size: var(--fs-sm);
  font-weight: 550;
  line-height: 1.5;
}

.form__status:empty {
  display: none;
}

.form__status--pending {
  color: var(--text-mute);
}

.form__status--success {
  color: var(--success);
}

.form__status--error {
  color: var(--danger);
}

.form__note {
  font-size: var(--fs-xs);
  color: var(--text-mute);
  line-height: 1.6;
}

/* Button loading state */

.btn.is-loading {
  pointer-events: none;
  opacity: 0.8;
}

.btn.is-loading .btn__label::after {
  content: "";
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.5em;
  vertical-align: -0.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   Modal (waitlist)
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: rgb(var(--ink-rgb) / 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur);
  overflow-y: auto;
}

.modal.is-open {
  opacity: 1;
  visibility: visible;
}

.modal__dialog {
  position: relative;
  width: min(100%, 540px);
  max-height: calc(100vh - 2 * var(--gutter));
  overflow-y: auto;
  padding: clamp(1.5rem, 1.2rem + 1.5vw, 2.25rem);
  background: var(--n-800);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  transform: translateY(12px) scale(0.99);
  transition: transform var(--dur) var(--ease-out);
}

.modal.is-open .modal__dialog {
  transform: translateY(0) scale(1);
}

.modal__close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease);
}

.modal__close:hover {
  background: rgb(var(--ink-rgb) / 0.07);
  color: var(--text);
}

.modal__title {
  margin-top: var(--sp-2);
  font-size: var(--fs-h3);
}

.modal__intro {
  margin-top: var(--sp-3);
  margin-bottom: var(--sp-5);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
}

body.is-locked {
  overflow: hidden;
}

/* ==========================================================================
   Toast
   ========================================================================== */

/* Seated above the back-to-top button so the two never overlap. */
.toast-region {
  position: fixed;
  right: var(--sp-5);
  bottom: calc(var(--sp-5) + 56px);
  z-index: var(--z-toast);
  display: grid;
  gap: var(--sp-3);
  width: min(360px, calc(100vw - 2 * var(--sp-5)));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--n-750);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  font-size: var(--fs-sm);
  line-height: 1.5;
  pointer-events: auto;
  animation: toast-in var(--dur) var(--ease-out) both;
}

.toast--success {
  border-left: 3px solid var(--success);
}

.toast--error {
  border-left: 3px solid var(--danger);
}

.toast.is-leaving {
  animation: toast-out var(--dur) var(--ease) both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ==========================================================================
   Reveal on scroll
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Never hide content if JS never runs or motion is unwelcome. */
.no-js .reveal,
.reveal--off {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ==========================================================================
   Back to top
   ========================================================================== */

.to-top {
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  z-index: calc(var(--z-header) - 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--n-750);
  color: var(--text);
  box-shadow: var(--sh-md);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
    visibility var(--dur), background-color var(--dur-fast) var(--ease);
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  background: var(--blue-50);
  border-color: var(--blue-500);
}

.to-top svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   Post cards — the Writing archive and the home page strip

   One card component serves both places. The whole card is the click target
   (the title's ::after covers it), so the pointer area matches what the eye
   reads as a single unit.
   ========================================================================== */

.post-grid {
  display: grid;
  gap: clamp(1.1rem, 0.9rem + 0.9vw, 1.75rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}

.post-grid > * + * {
  margin-top: 0;
}

.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  transition: transform var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: rgb(var(--brand-rgb) / 0.34);
  box-shadow: var(--sh-md);
}

/* The card is one link, so the focus ring belongs to the card, not the text. */
.post-card:focus-within {
  border-color: var(--blue-600);
  box-shadow: var(--focus-ring);
}

.post-card__media {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--blue-50);
  border-bottom: 1px solid var(--line);
}

.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out);
}

/* No cover on the post: a calm wash keeps the card's proportions and the
   row's alignment without inventing artwork. */
.post-card__media--blank {
  background: linear-gradient(135deg, var(--blue-100) 0%, var(--blue-50) 55%, #fff 100%);
}

.post-card__media--blank::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 78% 24%, rgb(var(--brand-rgb) / 0.16), transparent 62%),
    radial-gradient(circle at 22% 82%, rgb(var(--brand-rgb) / 0.1), transparent 58%);
}

.post-card:hover .post-card__media img {
  transform: scale(1.035);
}

.post-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--sp-2);
  padding: clamp(1.1rem, 0.95rem + 0.6vw, 1.5rem);
}

.post-card__badge {
  align-self: flex-start;
  margin-bottom: var(--sp-1);
}

.post-card__meta {
  font-size: var(--fs-xs);
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}

.post-card__title {
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 600;
  line-height: var(--lh-snug);
  letter-spacing: -0.012em;
}

.post-card__link {
  color: var(--heading);
  text-decoration: none;
}

.post-card__link:hover {
  color: var(--blue-700);
}

/* Stretches the link over the whole card without nesting interactive
   elements inside one another. */
.post-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
}

.post-card__link:focus-visible {
  outline: none;
  box-shadow: none;
}

.post-card__excerpt {
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: var(--text-soft);
}

.post-card__more {
  margin-top: auto;
  padding-top: var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand);
}

.post-card__more span::after {
  content: " \2192";
  display: inline-block;
  transition: transform var(--dur) var(--ease-out);
}

.post-card:hover .post-card__more span::after {
  transform: translateX(4px);
}


/* ==========================================================================
   Reader — a Substack post rendered in this site's typography
   ========================================================================== */

.reader-shell {
  padding-block: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
}

.post {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.post__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

.post__back::before {
  content: "\2190";
  transition: transform var(--dur) var(--ease-out);
}

.post__back:hover::before {
  transform: translateX(-3px);
}

.post__header {
  margin-top: var(--sp-6);
}

.post__meta {
  font-size: var(--fs-xs);
  font-weight: 620;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--blue-700);
  font-variant-numeric: tabular-nums;
}

.post__title {
  margin-top: var(--sp-3);
  font-size: var(--fs-h1);
  letter-spacing: -0.02em;
}

.post__title:focus-visible {
  outline: none;
  box-shadow: none;
}

.post__subtitle {
  margin-top: var(--sp-4);
  font-size: var(--fs-lead);
  line-height: var(--lh-loose);
  color: var(--text-soft);
}

.post__cover {
  margin-block: clamp(1.75rem, 1.4rem + 1.6vw, 2.75rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}

.post__cover img {
  width: 100%;
  height: auto;
}

/* ---- Injected post body --------------------------------------------------
   Everything below styles HTML that came from Substack. It is deliberately
   element-based rather than class-based: the source markup is not ours and
   its class names are not a contract.
   ------------------------------------------------------------------------- */

.post__body {
  margin-top: var(--sp-6);
  font-size: 1.09rem;
  line-height: var(--lh-loose);
  color: var(--text-soft);
}

.post__body > * + * {
  margin-top: var(--sp-5);
}

.post__body h1,
.post__body h2,
.post__body h3,
.post__body h4 {
  margin-top: var(--sp-8);
  color: var(--heading);
}

.post__body h1,
.post__body h2 {
  font-size: var(--fs-h2);
}

.post__body h3 {
  font-size: var(--fs-h3);
}

.post__body strong,
.post__body b {
  color: var(--text);
}

.post__body a {
  color: var(--brand);
  text-decoration-thickness: 1px;
}

.post__body ul,
.post__body ol {
  padding-left: 1.35em;
}

.post__body li + li {
  margin-top: var(--sp-3);
}

.post__body blockquote {
  padding-left: var(--sp-5);
  border-left: 3px solid var(--blue-300);
  color: var(--text);
  font-style: italic;
}

.post__body hr {
  height: 1px;
  border: 0;
  background: var(--line);
}

.post__body pre {
  padding: var(--sp-4);
  overflow-x: auto;
  background: var(--n-850);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

.post__body code {
  padding: 0.15em 0.4em;
  background: var(--n-850);
  border-radius: var(--r-xs);
  font-size: 0.92em;
}

.post__body pre code {
  padding: 0;
  background: none;
}

.post__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.post__body th,
.post__body td {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  text-align: left;
}

.post__body th {
  background: var(--n-850);
  color: var(--text);
}

.post__body img {
  border-radius: var(--r-md);
}

/* Substack ships captioned images as a real <figure>, so these rules cover
   both its markup and the embeds rewriteEmbeds builds. */
.post__body figure,
.post-embed {
  margin-block: var(--sp-6);
}

.post__body figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.post__body figcaption {
  margin-top: var(--sp-3);
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--text-mute);
  text-align: center;
}

/* An image wrapped in a link should not pick up link underlines. */
.post__body figure a {
  display: block;
  text-decoration: none;
}

.post-embed--video iframe {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--r-md);
}

.post-embed--link a {
  font-weight: 600;
}

/* Only for posts that are genuinely subscriber-only. A post whose text has
   not been cached yet never reaches the reader at all — its card links
   straight to Substack instead. */
.post__gate {
  padding: var(--sp-5);
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

.post__foot {
  margin-top: clamp(2.25rem, 1.75rem + 2vw, 3.5rem);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--line);
}

.post__foot-text {
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--text-mute);
}

.post-nav {
  display: grid;
  gap: var(--sp-3);
  margin-top: var(--sp-7);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.post-nav__link {
  display: grid;
  gap: 0.3rem;
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-xs);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.post-nav__link:hover {
  border-color: rgb(var(--brand-rgb) / 0.34);
  background: var(--surface-raised);
}

.post-nav__label {
  font-size: var(--fs-xs);
  font-weight: 620;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.post-nav__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: var(--lh-snug);
  color: var(--heading);
}

/* The lead card: full width, image beside the text. Used for the newest
   post on the archive so a short publication still fills its page. */
.post-card--feature {
  grid-column: 1 / -1;
}

@media (min-width: 720px) {
  .post-card--feature {
    flex-direction: row;
    align-items: stretch;
  }

  .post-card--feature .post-card__media {
    flex: 0 0 44%;
    aspect-ratio: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .post-card--feature .post-card__body {
    justify-content: center;
    gap: var(--sp-3);
    padding: clamp(1.5rem, 1.1rem + 1.6vw, 2.5rem);
  }

  .post-card--feature .post-card__title {
    font-size: clamp(1.45rem, 1.15rem + 1.1vw, 2rem);
  }

  .post-card--feature .post-card__excerpt {
    font-size: var(--fs-body);
  }

  .post-card--feature .post-card__more {
    margin-top: var(--sp-2);
    padding-top: 0;
  }
}
