/* ============================================================
   Daedalus — POH Library
   Searchable aircraft Pilot Operating Handbook repository.
   Loaded after /website/styles.css. Reuses the wiki hero +
   sidebar language; adds the gated-download + upload UI.
   ============================================================ */

/* ---------- Hero ---------- */
.poh-hero {
  position: relative;
  padding: 80px 0 52px;
  border-bottom: 1px solid var(--border-subtle);
  background:
    radial-gradient(ellipse at 82% 18%, rgba(255,181,71,0.10), transparent 52%),
    radial-gradient(ellipse at 8% 95%, rgba(61,216,232,0.08), transparent 60%);
  overflow: hidden;
}
.poh-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(0deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000, transparent 75%);
}
.poh-hero-inner { position: relative; }
.poh-hero h1 {
  font-size: clamp(40px, 5vw, 60px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-top: 12px;
  text-wrap: balance;
}
.poh-hero h1 em { font-style: italic; color: var(--brand-cyan); }
.poh-hero p {
  margin-top: 14px;
  font-size: 17px;
  color: var(--fg-2);
  max-width: 660px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---------- Search ---------- */
.poh-search {
  margin-top: 28px;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 14px 10px 18px;
  max-width: 580px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  transition: border-color var(--dur-state) var(--ease-out);
}
.poh-search:focus-within { border-color: var(--border-cyan); box-shadow: 0 0 0 3px rgba(61,216,232,0.12); }
.poh-search svg { width: 16px; height: 16px; color: var(--fg-3); flex-shrink: 0; }
.poh-search input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--fg-1);
}
.poh-search input::placeholder { color: var(--fg-4); }

.poh-stat-row {
  margin-top: 26px;
  display: flex; gap: 34px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--fg-3);
}
.poh-stat-row strong { color: var(--fg-1); font-weight: 600; }
.poh-stat-row .poh-lock-pill {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--brand-amber);
}
.poh-stat-row .poh-lock-pill.is-unlocked { color: var(--state-success, #2F8F54); }
.poh-stat-row .poh-lock-pill svg { width: 13px; height: 13px; }

/* ---------- Layout ---------- */
.poh-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 56px;
  padding: 48px 0 96px;
  align-items: flex-start;
}
.poh-sidebar { position: sticky; top: 96px; display: flex; flex-direction: column; gap: 28px; }
.poh-side-h {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.poh-side-list { display: flex; flex-direction: column; gap: 2px; }
.poh-side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--fg-2);
  transition: all var(--dur-state) var(--ease-out);
  cursor: pointer; border: 0; background: transparent;
  text-align: left; font-family: var(--font-sans); width: 100%;
}
.poh-side-item:hover { background: var(--surface-2); color: var(--fg-1); }
.poh-side-item.is-active {
  background: rgba(61,216,232,0.10);
  color: var(--brand-cyan);
  border-left: 2px solid var(--brand-cyan);
  padding-left: 10px;
}
.poh-side-item-count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--fg-3); }

/* Contribute card in the sidebar */
.poh-contribute {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255,181,71,0.08), rgba(255,181,71,0.02));
  border: 1px solid rgba(255,181,71,0.22);
}
.poh-contribute h4 { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 6px; }
.poh-contribute p { font-size: 12.5px; color: var(--fg-2); line-height: 1.5; margin: 0 0 12px; text-wrap: pretty; }

/* ---------- Toolbar (type filter + sort) ---------- */
.poh-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.poh-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.poh-chip {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: var(--surface-1);
  color: var(--fg-2);
  cursor: pointer;
  transition: all var(--dur-state) var(--ease-out);
}
.poh-chip:hover { border-color: var(--border-cyan); color: var(--fg-1); }
.poh-chip.is-active { background: var(--brand-cyan); border-color: var(--brand-cyan); color: var(--fg-on-cyan, #06242a); font-weight: 600; }
.poh-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.10em; text-transform: uppercase; color: var(--fg-3); }

/* ---------- POH cards ---------- */
.poh-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.poh-card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 22px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: all var(--dur-state) var(--ease-out);
}
.poh-card:hover { border-color: var(--border-cyan); box-shadow: var(--e1); }
.poh-card.is-soon { opacity: 0.72; }
.poh-card.is-soon:hover { opacity: 1; border-color: var(--border-default); box-shadow: none; }
.poh-card.is-soon .poh-doc { filter: grayscale(1); opacity: 0.6; }
.poh-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.poh-cover {
  width: 84px; height: 108px; flex: none; padding: 0; cursor: pointer;
  border: 1px solid var(--border-default); border-radius: 6px; overflow: hidden;
  background: #fff; box-shadow: 0 2px 8px rgba(15,17,22,0.08);
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.poh-cover:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,17,22,0.14); }
.poh-cover:disabled { cursor: default; transform: none; }
.poh-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.poh-doc {
  width: 42px; height: 52px; flex: none;
  border-radius: 5px;
  background: var(--surface-inset, #11141b);
  border: 1px solid var(--border-default);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
}
.poh-doc::after {
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(61,216,232,0.06) 0 6px, transparent 6px 12px);
}
.poh-doc span {
  position: relative;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--brand-cyan);
}
.poh-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.poh-tag {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-default); color: var(--fg-2);
}
.poh-tag.is-official { color: var(--state-success, #2F8F54); border-color: rgba(47,143,84,0.35); background: rgba(47,143,84,0.08); }
.poh-tag.is-community { color: var(--brand-amber); border-color: rgba(255,181,71,0.30); background: rgba(255,181,71,0.07); }
.poh-card h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; margin: 0 0 3px; }
.poh-card-sub { font-size: 13px; color: var(--fg-3); margin-bottom: 14px; }
.poh-doctype { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--brand-cyan); margin-bottom: 10px; }

.poh-spec {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px 16px;
  margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--border-subtle);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-3);
}
.poh-spec span strong { color: var(--fg-1); font-weight: 600; }

.poh-card-foot { margin-top: 16px; display: flex; align-items: center; gap: 10px; }
.poh-dl {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--dur-state) var(--ease-out);
  text-decoration: none;
}
.poh-dl svg { width: 15px; height: 15px; }
.poh-dl.is-locked { background: var(--surface-2); border-color: var(--border-default); color: var(--fg-2); }
.poh-dl.is-locked:hover { border-color: var(--brand-amber); color: var(--fg-1); }
.poh-dl.is-preview { flex: 0 0 auto; padding: 9px 12px; background: transparent; border-color: var(--border-default); color: var(--fg-2); }
.poh-dl.is-preview:hover { border-color: var(--brand-cyan); color: var(--fg-1); }
.poh-preview-modal { max-width: 860px; width: min(90vw, 860px); }
.poh-preview-frame { width: 100%; height: min(78vh, 900px); border: 1px solid var(--border-subtle); border-radius: 8px; margin-top: 14px; background: #fff; }
.poh-dl.is-open { background: var(--brand-cyan); color: var(--fg-on-cyan, #06242a); }
.poh-dl.is-open:hover { filter: brightness(1.06); }
.poh-size { font-family: var(--font-mono); font-size: 11px; color: var(--fg-4); white-space: nowrap; }

.poh-empty {
  padding: 80px 24px; text-align: center; color: var(--fg-3);
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.10em; text-transform: uppercase;
  border: 1px dashed var(--border-subtle); border-radius: var(--radius-lg);
}

/* ---------- Modal (gate + contribute) ---------- */
.poh-modal-scrim {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6,8,12,0.66);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: poh-fade 0.18s ease;
}
@keyframes poh-fade { from { opacity: 0; } to { opacity: 1; } }
.poh-modal {
  width: 100%; max-width: 440px;
  background: var(--surface-0, #0F1116);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--e3, 0 24px 60px rgba(0,0,0,0.5));
  padding: 30px 28px 26px;
  position: relative;
  animation: poh-pop 0.2s var(--ease-out, cubic-bezier(.2,.7,.3,1));
}
@keyframes poh-pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.poh-modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--border-subtle); background: var(--surface-1);
  color: var(--fg-3); cursor: pointer; display: grid; place-items: center;
}
.poh-modal-close:hover { color: var(--fg-1); border-color: var(--border-default); }
.poh-modal-close svg { width: 15px; height: 15px; }
.poh-modal-eyebrow { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand-cyan); }
.poh-modal h2 { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 10px 0 8px; text-wrap: balance; }
.poh-modal p { font-size: 14px; color: var(--fg-2); line-height: 1.55; margin: 0 0 18px; text-wrap: pretty; }
.poh-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.poh-field label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-3); }
.poh-field input, .poh-field select {
  font-family: var(--font-sans); font-size: 14px; padding: 11px 12px;
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  background: var(--surface-1); color: var(--fg-1);
}
.poh-field input:focus, .poh-field select:focus { outline: 2px solid var(--brand-cyan); outline-offset: 1px; border-color: var(--brand-cyan); }
.poh-modal-btn {
  width: 100%; margin-top: 4px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--brand-cyan); color: var(--fg-on-cyan, #06242a);
  font-size: 14.5px; font-weight: 700; border: 0; cursor: pointer;
  transition: filter var(--dur-state) var(--ease-out);
}
.poh-modal-btn:hover:not(:disabled) { filter: brightness(1.06); }
.poh-modal-btn:disabled { opacity: 0.6; cursor: default; }
.poh-consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--fg-3); line-height: 1.45; margin: 4px 0 16px; cursor: pointer; }
.poh-consent input { margin-top: 2px; accent-color: var(--brand-cyan); }
.poh-modal-fine { font-family: var(--font-mono); font-size: 10.5px; color: var(--fg-4); letter-spacing: 0.03em; margin: 14px 0 0; text-align: center; }
.poh-modal-msg { font-size: 13px; margin: 0 0 12px; color: var(--fg-2); }
.poh-modal-msg.is-error { color: var(--brand-amber); }
.poh-turnstile { margin: 2px 0 4px; min-height: 0; }

.poh-success { text-align: center; padding: 8px 0 0; }
.poh-success-ring {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 50%; background: rgba(47,143,84,0.12);
  border: 1px solid rgba(47,143,84,0.4);
  display: grid; place-items: center; color: var(--state-success, #2F8F54);
}
.poh-success-ring svg { width: 26px; height: 26px; }

/* ---------- Toast ---------- */
.poh-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 210;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-radius: var(--radius-pill);
  background: var(--surface-1); border: 1px solid rgba(47,143,84,0.4);
  color: var(--fg-1); font-size: 13.5px; font-weight: 500;
  box-shadow: var(--e2);
  animation: poh-toast-in 0.25s var(--ease-out);
}
.poh-toast svg { width: 16px; height: 16px; color: var(--state-success, #2F8F54); }
@keyframes poh-toast-in { from { transform: translate(-50%, 16px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.poh-disc {
  margin-top: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-3);
  text-align: center; letter-spacing: 0.04em; line-height: 1.6;
  padding: 0 16px;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .poh-layout { grid-template-columns: 1fr; gap: 28px; padding: 36px 0 64px; }
  .poh-sidebar { position: static; }
  .poh-side-list { flex-direction: row; flex-wrap: wrap; }
  .poh-side-item { width: auto; flex: 1 1 calc(50% - 4px); }
  .poh-grid { grid-template-columns: 1fr; }
}
