/* document.css — the floating "documents" dialog (résumé + cover letter)
 * --------------------------------------------------------------
 * Surfaced from the home page as a single translucent sheet that
 * floats in the aurora and blurs everything behind it. Built on
 * tokens.css — same void palette, same Migra / Erode / JetBrains
 * Mono type, same aurora-hue accent. Reverse-out, not parchment.
 * -------------------------------------------------------------- */

/* ---------- Backdrop: blur + dim the whole page behind ---------- */
.doc-dialog::backdrop {
  background: rgba(6, 7, 10, 0.5);
  -webkit-backdrop-filter: blur(18px) saturate(0.85);
          backdrop-filter: blur(18px) saturate(0.85);
  animation: doc-backdrop var(--t-base, 300ms) var(--ease, ease) both;
}
@keyframes doc-backdrop { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Dialog box = full viewport; the panel is centered in it ----------
   Making the dialog fill the viewport lets a click on the empty margin
   (outside the panel) close it, while ::backdrop carries the blur. */
.doc-dialog {
  border: none; outline: none; padding: clamp(14px, 4vw, 44px);
  margin: 0; max-width: 100vw; max-height: 100svh;
  width: 100vw; height: 100svh;
  background: transparent; color: var(--fg);
}
.doc-dialog:not([open]) { display: none; }
.doc-dialog[open] { display: grid; place-items: center; }

/* ---------- The floating glass sheet ---------- */
.doc-shell {
  position: relative;
  display: flex; flex-direction: column;
  width: min(720px, 100%);
  max-height: 100%;
  border-radius: 22px;
  /* frameless glass — more transparent, the aurora reads right through it */
  background: linear-gradient(180deg, rgba(44, 48, 62, 0.28), rgba(18, 21, 30, 0.38));
  -webkit-backdrop-filter: blur(36px) saturate(1.45);
          backdrop-filter: blur(36px) saturate(1.45);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.10) inset,
    0 60px 150px -42px rgba(0, 0, 0, 0.86),
    0 0 130px -20px hsla(var(--aurora-hue), 72%, 62%, 0.36);
  overflow: hidden;
  animation: doc-in var(--t-slow, 450ms) var(--ease, ease);
}
/* aurora light catching the top edge */
.doc-shell::before {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(180deg, hsla(var(--aurora-hue), 85%, 72%, 0.12), transparent 22%);
}
/* soft fade where the scroll meets the foot */
.doc-shell::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34px; z-index: 2;
  pointer-events: none; border-radius: 0 0 22px 22px;
  background: linear-gradient(to top, rgba(16, 18, 26, 0.5), transparent);
}
@keyframes doc-in {
  from { opacity: 0; transform: translateY(20px) scale(0.975); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .doc-shell, .doc-dialog::backdrop { animation: none; }
}

/* ---------- Header (sticky chrome) ---------- */
.doc-head {
  position: relative; z-index: 4;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 14px 12px 18px;
}
.seg {
  display: inline-flex; gap: 3px; padding: 3px;
  border: 1px solid var(--rule); border-radius: 30px;
  background: rgba(244, 242, 238, 0.03);
}
.seg-btn {
  appearance: none; border: none; cursor: pointer; background: transparent;
  color: var(--fg-dim);
  font-family: var(--font-mono); font-size: var(--text-tiny);
  letter-spacing: var(--tracking-loose); text-transform: uppercase;
  padding: 7px 15px; border-radius: 24px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.seg-btn:hover { color: var(--fg); }
.seg-btn[aria-selected="true"] {
  color: var(--fg);
  background: hsla(var(--aurora-hue), 50%, 45%, 0.24);
  box-shadow: 0 0 18px -4px hsla(var(--aurora-hue), 65%, 60%, 0.4);
}
.seg-btn:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }

.doc-actions { display: inline-flex; align-items: center; gap: 8px; }
.doc-dl {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 24px;
  border: 1px solid hsla(var(--aurora-hue), 60%, 70%, 0.4);
  background: hsla(var(--aurora-hue), 50%, 40%, 0.16);
  color: var(--fg); border-bottom: 1px solid hsla(var(--aurora-hue), 60%, 70%, 0.4);
  font-family: var(--font-mono); font-size: var(--text-tiny);
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.doc-dl:hover {
  background: hsla(var(--aurora-hue), 55%, 48%, 0.26);
  border-color: hsla(var(--aurora-hue), 70%, 78%, 0.7);
  box-shadow: 0 0 26px -4px hsla(var(--aurora-hue), 65%, 60%, 0.4);
}
.doc-dl .ico { width: 13px; height: 13px; display: block; }
.doc-close {
  appearance: none; cursor: pointer;
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--rule); border-radius: 50%;
  background: rgba(244, 242, 238, 0.03); color: var(--fg-dim);
  font-size: 17px; line-height: 1;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.doc-close:hover { color: var(--fg); border-color: var(--fg-dim); }
.doc-close:active { transform: scale(0.92); }
.doc-close:focus-visible { outline: 1px solid var(--fg); outline-offset: 2px; }

/* ---------- Scroll body ---------- */
.doc-scroll {
  position: relative; z-index: 1;
  overflow-y: auto; overscroll-behavior: contain;
  padding: clamp(24px, 4vw, 44px) clamp(20px, 4.5vw, 50px) clamp(34px, 5vw, 56px);
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}
.doc-scroll::-webkit-scrollbar { width: 9px; }
.doc-scroll::-webkit-scrollbar-thumb {
  background: var(--rule-strong); border-radius: 9px;
  border: 2px solid transparent; background-clip: padding-box;
}

.doc-panel[hidden] { display: none; }
.doc-panel { animation: doc-swap var(--t-base, 300ms) var(--ease, ease); }
@keyframes doc-swap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .doc-panel { animation: none; } }

/* ---------- Document typography (site-native, reverse-out) ---------- */
.doc-name {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: clamp(34px, 6vw, 54px); line-height: 0.98;
  letter-spacing: var(--tracking-display); margin: 0; color: var(--fg);
  text-shadow: 0 0 60px hsla(var(--aurora-hue), 60%, 60%, 0.22);
}
.doc-sub {
  margin: 12px 0 0; font-family: var(--font-mono);
  font-size: var(--text-tiny); letter-spacing: var(--tracking-loose);
  text-transform: uppercase; color: var(--fg-dim);
}
.doc-contact {
  margin: 7px 0 0; font-family: var(--font-mono);
  font-size: var(--text-tiny); letter-spacing: 0.04em; color: var(--fg-faint);
}
.doc-contact a { color: var(--fg-dim); border-bottom: 1px solid var(--rule); }
.doc-contact a:hover { color: var(--fg); border-bottom-color: var(--fg-dim); }

.doc-summary {
  margin: 20px 0 0;
  font-size: 15px; line-height: 1.72; color: var(--fg-dim);
}
.doc-summary strong { color: var(--fg); font-weight: 400; }

/* Section label — same vocabulary as the home page's .label */
.doc-sec {
  display: flex; align-items: center; gap: 8px;
  margin: 32px 0 14px;
  font-family: var(--font-mono); font-size: var(--text-tiny);
  letter-spacing: var(--tracking-loose); text-transform: uppercase;
  color: var(--fg-faint);
}
.doc-sec::before { content: ""; width: 16px; height: 1px; background: var(--rule-strong); }
.doc-sec::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--rule); }

/* Experience / project entries */
.doc-job { padding: 14px 0; border-top: 1px solid var(--rule); }
.doc-job:first-of-type { border-top: none; padding-top: 4px; }
.doc-job h3 {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: 19px; line-height: 1.2; color: var(--fg);
}
.doc-job .meta {
  margin: 4px 0 9px; font-family: var(--font-mono);
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-faint);
}
.doc-job .meta b { color: var(--fg-dim); font-weight: 400; }
.doc-job ul { margin: 0; padding-left: 1.05em; list-style: none; }
.doc-job li { position: relative; margin: 0 0 7px; color: var(--fg-dim); line-height: 1.62; }
.doc-job li::before {
  content: ""; position: absolute; left: -1.05em; top: 0.66em;
  width: 5px; height: 1px; background: hsla(var(--aurora-hue), 60%, 65%, 0.8);
}
.doc-job li b, .doc-summary b, .doc-fine b { color: var(--fg); font-weight: 400; }

/* Skills — two columns of label/value */
.doc-skills { margin: 4px 0 0; columns: 2; column-gap: clamp(20px, 4vw, 46px); }
.doc-skills .row { break-inside: avoid; margin: 0 0 11px; }
.doc-skills dt {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-faint); margin-bottom: 2px;
}
.doc-skills dd { margin: 0; color: var(--fg-dim); font-size: 14px; line-height: 1.5; }
@media (max-width: 560px) { .doc-skills { columns: 1; } }

.doc-fine { color: var(--fg-dim); font-size: 14px; line-height: 1.6; margin: 2px 0 0; }
.doc-meta-italic { color: var(--fg-dim); font-style: italic; margin: 2px 0 8px; }

/* ---------- Cover letter ---------- */
.doc-letter { margin-top: 2px; }  /* fills the panel width */
.doc-letter p { margin: 0 0 14px; color: var(--fg-dim); font-size: 15px; line-height: 1.78; }
.doc-letter .salutation { color: var(--fg); margin-bottom: 16px; }
.doc-sign { margin-top: 22px; }
.doc-sign .so { color: var(--fg-dim); font-size: 15px; }
.doc-sign .name {
  display: block; margin-top: 6px;
  font-family: var(--font-display); font-style: italic; font-size: 30px;
  color: var(--fg); text-shadow: 0 0 40px hsla(var(--aurora-hue), 60%, 60%, 0.22);
}

/* foot rule inside a panel */
.doc-foot {
  margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-faint);
  display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between;
}
.doc-foot a { color: var(--fg-dim); border-bottom: 1px solid var(--rule); }
.doc-foot a:hover { color: var(--fg); }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .doc-head { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .seg { order: 2; flex: 1 1 100%; justify-content: center; }
  .doc-actions { order: 1; width: 100%; justify-content: space-between; }
  .doc-name { font-size: 32px; }
}
