/* =========================================================
   EXPANDED PANEL (on tap)
   ========================================================= */
.expanded-scrim {
  position: fixed; inset: 0;
  background: rgba(13, 10, 6, 0.88);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms;
  z-index: 200;
}
.expanded-scrim.open { opacity: 1; pointer-events: auto; }

.expanded-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(820px, 94vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--gold-dim);
  transform: translateX(100%);
  transition: transform 520ms var(--ease-cinema);
  z-index: 210;
  overflow-y: auto;
  padding: 60px 56px 80px;
}
.expanded-panel.open { transform: translateX(0); }
.expanded-panel::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 2px;
  background: linear-gradient(to bottom, transparent, var(--gold-hi), transparent);
  opacity: 0.6;
}
.expanded-panel .close {
  position: absolute; top: 24px; right: 24px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  color: var(--gold-dim); padding: 8px 12px;
  border: 1px solid rgba(138, 111, 46, 0.3);
  transition: all 200ms;
}
.expanded-panel .close:hover { color: var(--gold-hi); border-color: var(--gold); }

.expanded-panel .tag-line {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em;
  color: var(--gold); text-transform: uppercase; margin-bottom: 20px;
}
.expanded-panel h3 {
  font-family: var(--serif); font-weight: 500; font-size: 48px; line-height: 1;
  color: var(--parchment); margin-bottom: 24px; letter-spacing: -0.015em;
}
.expanded-panel .lede {
  font-family: var(--serif); font-size: 22px; line-height: 1.45;
  color: var(--gold-hi); font-style: italic; margin-bottom: 40px;
  max-width: 640px;
}
.expanded-panel .body { font-size: 15px; line-height: 1.7; color: var(--parchment); }
.expanded-panel .body p { margin-bottom: 18px; max-width: 620px; }
.expanded-panel .body p em { color: var(--gold-hi); font-family: var(--serif); font-style: italic; }

.expanded-panel .log {
  margin-top: 32px;
  font-family: var(--mono); font-size: 11px; line-height: 1.8;
  color: var(--gold-dim); letter-spacing: 0.1em;
  padding: 20px 24px;
  border: 1px solid rgba(138, 111, 46, 0.25);
  background: rgba(22, 17, 10, 0.6);
}
.expanded-panel .log .caret { color: var(--gold-hi); margin-right: 8px; }
.expanded-panel .aside {
  margin-top: 24px;
  font-family: var(--serif); font-style: italic; font-size: 18px;
  color: var(--parchment-muted); border-left: 2px solid var(--gold-dim); padding-left: 20px;
}

/* gate inside expanded panel */
.expanded-panel .gate-card {
  margin-top: 40px;
  padding: 28px;
  border: 1px dashed var(--gold-dim);
  background: rgba(13, 10, 6, 0.6);
  display: flex; gap: 20px; align-items: flex-start;
}
.expanded-panel .gate-card .icon {
  width: 48px; height: 48px; flex-shrink: 0;
}
.expanded-panel .gate-card .gate-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.3em;
  color: var(--gold-dim); margin-bottom: 6px;
}
.expanded-panel .gate-card h5 {
  font-family: var(--serif); font-weight: 500; font-size: 20px; color: var(--parchment); margin-bottom: 8px;
}
.expanded-panel .gate-card p {
  font-size: 14px; color: var(--parchment-muted); margin-bottom: 14px;
}
.expanded-panel .gate-card .request-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.25em;
  color: var(--gold-hi); padding: 8px 14px;
  border: 1px solid var(--gold-dim);
  transition: all 200ms;
  text-transform: uppercase;
}
.expanded-panel .gate-card .request-btn:hover { border-color: var(--gold-hi); background: rgba(232, 196, 124, 0.08); }
.gate-actions { display: flex; gap: 18px; align-items: center; margin-top: 14px; flex-wrap: wrap; }

/* =========================================================
   GATED FLOW (request access)
   ========================================================= */
.gated-scrim {
  position: fixed; inset: 0;
  background: rgba(13, 10, 6, 0.95);
  backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none;
  transition: opacity 400ms;
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.gated-scrim.open { opacity: 1; pointer-events: auto; }
.gated-envelope {
  width: min(560px, 94vw);
  padding: 48px 44px 40px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201,152,44,0.07), transparent 62%),
    linear-gradient(180deg, rgba(31,24,16,0.65), var(--bg-surface));
  border: 1px solid var(--gold-dim);
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform 500ms var(--ease-cinema);
  box-shadow:
    0 40px 90px -24px rgba(0,0,0,0.85),
    0 0 0 1px rgba(138,111,46,0.12),
    inset 0 1px 0 rgba(237,224,200,0.05);
}
.gated-envelope::before {
  content: "";
  position: absolute; inset: 9px;
  border: 1px solid rgba(138,111,46,0.20);
  pointer-events: none;
}
.gated-scrim.open .gated-envelope { transform: translateY(0) scale(1); }
.gated-envelope .wax {
  position: absolute; top: -22px; right: 20px;
  width: 90px; height: 90px;
  background: url("../assets/gold_wax-seal_gold.png") center / contain no-repeat;
  transform: rotate(8deg);
  filter: brightness(0.78) saturate(0.82) drop-shadow(0 7px 12px rgba(0,0,0,0.55));
  /* hide legacy monogram glyph */
  font-size: 0; color: transparent;
}
.gated-envelope .close {
  position: absolute; top: 12px; left: 12px;
  font-family: var(--mono); font-size: 16px; line-height: 1;
  color: var(--gold-dim);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(138,111,46,0.25);
  transition: color 200ms, border-color 200ms;
}
.gated-envelope .close:hover { color: var(--gold-hi); border-color: var(--gold); }
.gated-envelope .tag { font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em; color: var(--gold-dim); margin-bottom: 16px; text-transform: uppercase; }
.gated-envelope h4 { font-family: var(--serif); font-weight: 500; font-size: 32px; line-height: 1.05; color: var(--parchment); margin-bottom: 16px; letter-spacing: -0.01em; }
.gated-envelope p.lede { font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--gold-hi); margin-bottom: 24px; line-height: 1.5; }
.gated-envelope label { display: block; margin-bottom: 14px; }
.gated-envelope label span { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em; color: var(--gold-dim); margin-bottom: 6px; text-transform: uppercase; }
.gated-envelope input, .gated-envelope textarea {
  width: 100%; padding: 10px 12px;
  background: rgba(13, 10, 6, 0.6);
  border: 1px solid rgba(138, 111, 46, 0.35);
  color: var(--parchment);
  font-family: var(--serif); font-size: 16px;
  transition: border-color 200ms;
}
.gated-envelope textarea { min-height: 90px; resize: vertical; font-family: var(--sans); font-size: 14px; line-height: 1.5; }
.gated-envelope input:focus, .gated-envelope textarea:focus { border-color: var(--gold); }
.gated-envelope input:focus:not(:focus-visible),
.gated-envelope textarea:focus:not(:focus-visible) { outline: none; }
.gated-envelope .submit {
  margin-top: 20px;
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.25em;
  color: var(--bg-deep); background: var(--gold-hi); padding: 12px 20px;
  text-transform: uppercase;
  transition: background 200ms;
}
.gated-envelope .submit:hover { background: var(--gold); }
.gated-envelope .submit .arrow { width: 16px; height: 1px; background: currentColor; position: relative; }
.gated-envelope .submit .arrow::after { content: ""; position: absolute; right: 0; top: -3px; width: 7px; height: 7px; border-right: 1px solid currentColor; border-top: 1px solid currentColor; transform: rotate(45deg); }

.gated-envelope .sealed-msg {
  text-align: center; padding: 20px 0;
}
.gated-envelope .sealed-msg .seal {
  width: 104px; height: 104px; margin: 0 auto 22px;
  background: url("../assets/gold_wax-seal_gold.png") center / contain no-repeat;
  filter: brightness(0.82) saturate(0.85) drop-shadow(0 6px 12px rgba(0,0,0,0.5));
  /* hide legacy monogram glyph */
  font-size: 0; color: transparent;
}
.gated-envelope .sealed-msg h5 { font-family: var(--serif); font-weight: 500; font-size: 26px; color: var(--parchment); margin-bottom: 10px; }
.gated-envelope .sealed-msg p { font-family: var(--serif); font-style: italic; color: var(--gold-hi); font-size: 16px; }

/* =========================================================
   PREVIEW UNLOCK (inline-unlocked gate content inside expanded panel)
   ========================================================= */
.preview-unlock {
  margin-top: 40px;
  padding: 28px;
  border: 1px solid var(--ember);
  background:
    linear-gradient(180deg, rgba(217, 118, 66, 0.06), rgba(13, 10, 6, 0.6)),
    rgba(13, 10, 6, 0.6);
  position: relative;
}
.preview-unlock::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ember), transparent);
}
.preview-unlock .unlock-bar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.preview-unlock .stamp {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.3em;
  color: var(--bg-deep); background: var(--ember);
  padding: 3px 9px;
  text-transform: uppercase;
}
.preview-unlock .label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.25em;
  color: var(--gold-dim); text-transform: uppercase;
}
.preview-unlock .preview-tag {
  margin-left: auto;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.25em;
  color: var(--ember); text-transform: uppercase;
  border: 1px dashed var(--ember);
  padding: 2px 8px;
}
.preview-unlock .unlock-title {
  font-family: var(--serif); font-weight: 500; font-size: 30px;
  color: var(--parchment); margin-bottom: 24px; letter-spacing: -0.01em;
  line-height: 1.05;
}
.preview-unlock .unlock-section { margin-bottom: 22px; }
.preview-unlock .unlock-h {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.25em;
  color: var(--gold-hi); text-transform: uppercase;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.preview-unlock .unlock-h::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(to right, rgba(232, 196, 124, 0.3), transparent);
}
.preview-unlock .unlock-section p {
  font-family: var(--serif); font-size: 16px; line-height: 1.55;
  color: var(--parchment);
  max-width: 620px;
}
.preview-unlock .unlock-section p em {
  color: var(--gold-hi); font-style: italic;
}
.preview-unlock .unlock-foot {
  margin-top: 28px; padding-top: 16px;
  border-top: 1px dashed rgba(138, 111, 46, 0.3);
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em;
  color: var(--parchment-muted); text-transform: uppercase;
}

/* =========================================================
   GATED FOLLOW-UPS (alt link, errors, seal states)
   ========================================================= */
.gated-alt {
  margin-top: 18px; font-family: var(--serif); font-style: italic;
  font-size: 14px; color: var(--ink-dim); text-align: center;
}
.gated-alt .linklike { margin-left: 6px; font-style: normal; }
.gated-err {
  margin-top: 10px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.08em; color: #E07B6B; padding: 6px 10px;
  border-left: 2px solid #E07B6B; background: rgba(224,123,107,0.06);
}

.sealed-msg .seal.spinning {
  animation: sealSpin 1.2s linear infinite;
}
@keyframes sealSpin {
  from { transform: rotate(0deg); } to { transform: rotate(360deg); }
}
.gated-envelope .sealed-msg .seal.open-seal {
  filter: brightness(1.05) saturate(1) drop-shadow(0 0 16px rgba(232,196,124,0.45));
}
.sealed-msg .small { font-size: 12px; opacity: 0.6; margin-top: 12px; }

.preview-tag.you {
  background: rgba(232,196,124,0.14) !important;
  color: var(--gold-hi) !important;
  border-color: rgba(232,196,124,0.5) !important;
}

/* =========================================================
   NESTED ASK (inside unlocked gate)
   ========================================================= */
.nested-ask {
  margin-top: 28px; padding: 18px 20px;
  border: 1px dashed rgba(232,196,124,0.25);
  border-radius: 3px;
  background: rgba(232,196,124,0.03);
}
.nested-ask-prompt {
  font-family: var(--serif); font-style: italic; font-size: 15px;
  color: var(--ink); margin-bottom: 10px; line-height: 1.45;
}
.nested-ask.open {
  display: flex; flex-direction: column; gap: 10px;
}
.nested-ask textarea {
  width: 100%; background: rgba(0,0,0,0.3);
  border: 1px solid rgba(232,196,124,0.25);
  color: var(--ink); font-family: var(--serif); font-size: 14px;
  padding: 10px 12px; border-radius: 2px; resize: vertical;
  box-sizing: border-box;
}
.nested-ask textarea:focus { border-color: rgba(232,196,124,0.55); }
.nested-ask textarea:focus:not(:focus-visible) { outline: none; }
.nested-ask-actions {
  display: flex; justify-content: space-between; align-items: center;
}
.submit.small {
  padding: 8px 16px; font-size: 11px;
}
.nested-ask.sent {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-style: italic; color: var(--ink-dim);
}
.nested-ask.sent .check {
  color: var(--gold-hi); font-family: var(--mono);
}
.gated-envelope input[aria-invalid="true"],
.gated-envelope textarea[aria-invalid="true"] {
  border-color: #E07B6B;
  box-shadow: 0 0 0 1px rgba(224,123,107,0.25);
}

/* =========================================================
   GATED PAYOFF — projects, lab, career, writing, book
   ========================================================= */
.gate-projects { margin-top: 28px; display: grid; gap: 16px; }
.gate-project {
  padding: 18px 20px;
  border: 1px solid rgba(138,111,46,0.22);
  background: rgba(13,10,6,0.45);
}
.gate-project .gp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.gate-project .gp-name {
  font-family: var(--serif); font-weight: 500; font-size: 20px;
  color: var(--parchment); letter-spacing: -0.01em;
}
.gate-project .gp-status {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--gold-dim);
  border: 1px solid rgba(138,111,46,0.3); padding: 2px 7px; white-space: nowrap;
}
.gate-project .gp-status.live { color: var(--gold-hi); border-color: rgba(232,196,124,0.4); }
.gate-project .gp-blurb {
  font-family: var(--serif); font-size: 15px; line-height: 1.55;
  color: var(--parchment-muted); margin: 8px 0 0; max-width: 600px;
}
.gate-project .gp-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gate-project .gp-tag {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--gold-dim);
}
.gate-project .gp-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; }
.gate-project .gp-link {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--gold-hi); text-decoration: none;
  border-bottom: 1px dashed rgba(232,196,124,0.4); padding-bottom: 2px;
  transition: border-color 160ms;
}
.gate-project .gp-link:hover { border-color: var(--gold-hi); }

.gate-lab { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.gate-lab .gl-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--gold-dim);
}
.gate-lab .gl-list { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--parchment-muted); }

.gate-career {
  margin-top: 22px;
  font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.6;
  color: var(--gold-dim); max-width: 600px;
}

.gate-writing { margin-top: 30px; display: grid; gap: 26px; }
.gate-writing .gw-meta { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.gate-writing .gw-title {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--gold-hi);
}
.gate-writing .gw-kind {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--gold-dim);
}
.gate-writing .gw-body {
  font-family: 'Cormorant Garamond', var(--serif); font-style: italic;
  font-size: 19px; line-height: 1.5; color: var(--parchment);
  white-space: pre-line; max-width: 540px;
}

.gate-book {
  margin-top: 30px; padding: 22px 24px;
  border: 1px solid rgba(138,111,46,0.28);
  background: linear-gradient(180deg, rgba(31,24,16,0.5), rgba(13,10,6,0.4));
}
.gate-book .gb-label {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.25em;
  text-transform: uppercase; color: var(--gold-dim); margin-bottom: 10px;
}
.gate-book .gb-title {
  font-family: var(--serif); font-weight: 500; font-size: 24px;
  color: var(--parchment); margin: 0 0 10px; letter-spacing: -0.01em;
}
.gate-book .gb-blurb {
  font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.55;
  color: var(--gold-hi); margin: 0 0 16px; max-width: 560px;
}
.gate-book .gb-link {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold-hi); text-decoration: none;
  border-bottom: 1px dashed rgba(232,196,124,0.4); padding-bottom: 2px;
  transition: border-color 160ms;
}
.gate-book .gb-link:hover { border-color: var(--gold-hi); }
