/* ============================================================
   PORTFOLIO ATLAS — panels.css
   The slide-in placard and ALL of its injected content.

   panels.js injects markup into #panel-body using the classes
   below (.card / .page and children). Project cards aim for
   museum-placard quality: serif headers, monospace data labels.

   Consumes tokens from style.css :root. Desktop: right-edge
   drawer; mobile (< 768px): bottom sheet. Motion respects
   prefers-reduced-motion.
   ============================================================ */

/* ── Dim backdrop behind the centred card ─────────────────── */
.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-panel) - 1);
  background: rgba(44, 24, 16, 0.34);
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}
.panel-backdrop--open { opacity: 1; pointer-events: auto; }

/* ── Panel shell — centred modal card ────────────────────── */
.panel {
  position: fixed;
  top: 50%; left: 50%;
  width: min(460px, 94vw);
  max-height: 86vh;

  background-color: var(--parchment-panel);
  background-image:
    radial-gradient(circle at 18% 22%, rgba(139, 26, 26, 0.035) 0, transparent 42%),
    radial-gradient(circle at 82% 78%, rgba(44, 24, 16, 0.04) 0, transparent 46%),
    repeating-linear-gradient(0deg, rgba(44, 24, 16, 0.015) 0, rgba(44, 24, 16, 0.015) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(44, 24, 16, 0.012) 0, rgba(44, 24, 16, 0.012) 1px, transparent 1px, transparent 4px);
  background-blend-mode: multiply;
  color: var(--ink);

  border: 1px solid rgba(139, 26, 26, 0.42);
  border-radius: 6px;
  box-shadow: 0 26px 72px -20px rgba(44, 24, 16, 0.72);

  transform: translate(-50%, -48%) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: transform 360ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 300ms ease;

  z-index: var(--z-panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  will-change: transform, opacity;
}

.panel--open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* ── Close button ────────────────────────────────────────── */
.panel__close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1;
  color: var(--ink);
  background: rgba(244, 239, 224, 0.85);
  border: 1px solid var(--seal);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(44, 24, 16, 0.25);
  transition: background-color 200ms ease, color 200ms ease, transform 200ms ease;
}
.panel__close:hover,
.panel__close:focus-visible {
  background: var(--seal);
  color: var(--parchment);
  transform: rotate(90deg);
  outline: none;
}
.panel__close:focus-visible { box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.35); }

/* ── Scrollable body ─────────────────────────────────────── */
.panel__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 56px 26px 36px;
  scrollbar-width: thin;
  scrollbar-color: var(--seal) transparent;
}
.panel__body::-webkit-scrollbar { width: 10px; }
.panel__body::-webkit-scrollbar-track { background: transparent; }
.panel__body::-webkit-scrollbar-thumb {
  background: rgba(139, 26, 26, 0.55);
  border-radius: 8px;
  border: 2px solid var(--parchment-panel);
}
.panel__body::-webkit-scrollbar-thumb:hover { background: var(--seal); }

/* ============================================================
   PROJECT CARD  (item.type === 'project')
   ============================================================ */
.card { display: block; }

.card__thumb {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 18px;
  border: 1px solid rgba(44, 24, 16, 0.25);
  border-radius: 3px;
  box-shadow: 0 4px 14px -6px rgba(44, 24, 16, 0.5);
  filter: sepia(16%) saturate(106%) contrast(97%);
}

.card__badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--ink-soft);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(244, 239, 224, 0.25);
}
.card__badge--coastal        { background: var(--cat-coastal); }
.card__badge--remote-sensing { background: var(--cat-remote-sensing); }
.card__badge--gis            { background: var(--cat-gis); }
.card__badge--fieldwork      { background: var(--cat-fieldwork); }

.card__status {
  display: inline-block;
  margin: 0 0 12px 8px;
  padding: 4px 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--seal);
  background: rgba(212, 168, 67, 0.18);
  border: 1px dashed var(--seal);
  border-radius: 2px;
}

.card__title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.12;
  color: var(--ink);
}

.card__subtitle {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink-soft);
}

/* Monospace "data label" block — the museum-placard datum lines. */
.card__meta {
  margin: 0 0 18px;
  padding: 12px 14px;
  background: rgba(212, 168, 67, 0.10);
  border: 1px solid rgba(139, 26, 26, 0.22);
  border-left: 3px solid var(--seal);
  border-radius: 2px;
}
.card__meta dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
}
.card__meta dt {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}
.card__meta dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
}
.card__meta dd.is-ref { color: var(--seal); font-weight: 700; }

.card__tags {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Mono chips (.pill) — reused in tags AND page content ── */
.pill {
  display: inline-block;
  padding: 3px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: rgba(212, 168, 67, 0.14);
  border: 1px solid rgba(139, 26, 26, 0.4);
  border-radius: 2px;
  white-space: nowrap;
}
.page__content .pill,
.card__content .pill { margin: 2px 4px 2px 0; }

/* ── Card body sections ──────────────────────────────────── */
.card__section { margin-top: 20px; }
.card__section:first-of-type {
  padding-top: 16px;
  border-top: 1px solid rgba(139, 26, 26, 0.25);
}

.card__section h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  color: var(--seal-dark);
}

.card__lead {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0;
}

.card__section p {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--ink);
  margin: 0;
}

/* ── Key findings grid ───────────────────────────────────── */
.findings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.finding {
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(44, 24, 16, 0.18);
  border-radius: 3px;
}
.finding__stat {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  color: var(--seal);
}
.finding__unit {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-left: 3px;
}
.finding__label {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.card__actions { margin-top: 22px; }

/* ============================================================
   PAGE CARD  (item.type === 'page')
   ============================================================ */
.page { display: block; }

.page__eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 6px;
}

.page__title {
  margin: 0 0 6px;
  padding-bottom: 10px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 32px;
  line-height: 1.08;
  color: var(--ink);
  border-bottom: 2px solid var(--seal);
}

.page__ref {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--seal);
  margin: 0 0 18px;
}

.page__content { display: block; }

/* ============================================================
   LONG-FORM TYPOGRAPHY (shared .card__content + .page__content)
   ============================================================ */
.card__content,
.page__content {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: anywhere;     /* long URLs / refs never overflow the card */
}

.card__content h3,
.page__content h3 {
  margin: 24px 0 8px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 19px;
  line-height: 1.2;
  color: var(--seal-dark);
}
.card__content h3:first-child,
.page__content h3:first-child { margin-top: 0; }

.card__content p,
.page__content p { margin: 0 0 12px; }

.card__content ul,
.page__content ul { margin: 0 0 14px; padding-left: 0; list-style: none; }

.card__content li,
.page__content li {
  position: relative;
  margin: 0 0 7px;
  padding-left: 20px;
}
.card__content li::before,
.page__content li::before {
  content: "◆";
  position: absolute;
  left: 0; top: 0;
  font-size: 10px;
  line-height: 1.65;
  color: var(--seal);
}

.card__content strong,
.page__content strong { font-weight: 700; color: var(--ink); }

.card__content em,
.page__content em { font-style: italic; color: var(--ink-soft); }

.card__content a,
.page__content a {
  color: var(--seal);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 160ms ease;
}
.card__content a:hover,
.page__content a:hover,
.card__content a:focus-visible,
.page__content a:focus-visible {
  color: var(--seal-dark);
  text-decoration-thickness: 2px;
}
/* keep the wax-seal button readable: the generic content-link colour would
   otherwise win on specificity and paint the label crimson-on-crimson */
.card__content a.btn-seal,
.page__content a.btn-seal,
.card__content a.btn-seal:hover,
.page__content a.btn-seal:hover,
.card__content a.btn-seal:focus-visible,
.page__content a.btn-seal:focus-visible {
  color: var(--parchment);
  text-decoration: none;
}

/* ============================================================
   WAX-SEAL BUTTON / LINK (.btn-seal)
   ============================================================ */
.btn-seal {
  display: inline-block;
  margin: 8px 0;
  padding: 11px 19px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-decoration: none;
  color: var(--parchment);
  background: var(--seal);
  border: 1px solid var(--seal-dark);
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 6px -1px rgba(44, 24, 16, 0.45);
  transition: background-color 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}
.btn-seal:hover,
.btn-seal:focus-visible {
  background: var(--seal-dark);
  color: var(--parchment);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 12px -2px rgba(44, 24, 16, 0.55);
  outline: none;
}
.btn-seal:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 3px rgba(212, 168, 67, 0.55);
}
.btn-seal:active { transform: translateY(0); }

/* ============================================================
   CONTACT — link list (.contact-list)
   ============================================================ */
.contact-list { list-style: none; margin: 0 0 20px; padding: 0; }
.contact-list li {
  margin: 0; padding: 0;
  border-bottom: 1px dashed rgba(139, 26, 26, 0.3);
}
.contact-list li:last-child { border-bottom: 0; }
.contact-list a {
  display: block;
  padding: 10px 4px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color 160ms ease, padding-left 160ms ease, background-color 160ms ease;
}
.contact-list a:hover,
.contact-list a:focus-visible {
  color: var(--seal);
  padding-left: 10px;
  background: rgba(212, 168, 67, 0.1);
  outline: none;
}

/* ============================================================
   CONTACT — message form (.cform)
   ============================================================ */
.cform { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 16px; }
.cform label {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.cform input,
.cform textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--ink-soft);
  border-radius: 3px;
  box-shadow: inset 0 1px 2px rgba(44, 24, 16, 0.12);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.cform input::placeholder,
.cform textarea::placeholder { color: rgba(90, 70, 50, 0.6); }
.cform textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.cform input:focus,
.cform textarea:focus {
  outline: none;
  border-color: var(--seal);
  background: rgba(255, 255, 255, 0.7);
  box-shadow:
    inset 0 1px 2px rgba(44, 24, 16, 0.1),
    0 0 0 3px rgba(139, 26, 26, 0.2);
}
.cform .btn-seal { align-self: flex-start; margin-top: 12px; }

/* ============================================================
   MOBILE (< 768px) — centred card, near-full width
   ============================================================ */
@media (max-width: 767px) {
  .panel {
    width: 94vw;
    max-height: 88vh;
  }
  .panel__close { top: 12px; }
  .panel__body { padding: 50px 18px 28px; }
  .card__title { font-size: 25px; }
  .page__title { font-size: 27px; }
  .findings { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .panel { transition: none; }
  .panel__close, .btn-seal, .contact-list a, .cform input, .cform textarea,
  .card__content a, .page__content a { transition: none; }
  .panel__close:hover, .panel__close:focus-visible { transform: none; }
  .btn-seal:hover, .btn-seal:focus-visible { transform: none; }
}
