/* ============================================================
   THE WRITTEN VERSION
   ------------------------------------------------------------
   The same content, as a plain document.

   With JavaScript it is taken out of the visual flow but left in
   the accessibility tree, so a screen reader gets one clean,
   complete reading instead of a scroll-timed composition it
   cannot perceive. Without JavaScript — or on a printer — it is
   simply the site, and it is designed to be worth reading.
   ============================================================ */

.doc {
  max-width: 78ch;
  margin: 0 auto;
  padding: clamp(48px, 9vh, 120px) var(--gutter) clamp(64px, 12vh, 160px);
  position: relative;
  z-index: 1;
}

/* The device, as a picture. On the cover it is foil under a moving lamp;
   here the page is flat and unlit, so it is simply the mark. */
.doc__mark {
  display: block;
  width: clamp(120px, 22vw, 190px);
  height: auto;
  margin-bottom: clamp(20px, 4vh, 40px);
}

.doc__kicker {
  font-family: var(--font-meta);
  font-size: var(--t-meta);
  font-weight: 500;
  letter-spacing: var(--track-meta-wide);
  text-transform: uppercase;
  color: var(--color-accent-base);
  margin-bottom: 1.4em;
}

.doc h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: var(--track-display);
  color: var(--color-text-primary);
}

.doc__lede {
  font-size: var(--t-lede);
  color: var(--color-text-secondary);
  margin-top: 1em;
  max-width: 48ch;
}

.doc__head { border-bottom: 1px solid var(--color-border-faint); padding-bottom: clamp(24px, 5vh, 56px); }

.doc__sec { padding: clamp(28px, 6vh, 64px) 0; border-bottom: 1px solid var(--color-border-faint); }

.doc h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  color: var(--color-accent-light);
  margin-bottom: 0.9em;
}

.doc h3 {
  font-family: var(--font-meta);
  font-size: var(--t-meta);
  font-weight: 600;
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  color: var(--color-text-body);
  margin: 2em 0 0.8em;
}

.doc p { color: var(--color-text-body); margin-bottom: 1em; max-width: 68ch; }
.doc__role { color: var(--color-accent-base); font-size: var(--t-small); }

.doc ul {
  columns: 2;
  column-gap: clamp(20px, 4vw, 54px);
  margin-bottom: 1.4em;
}
.doc ul li {
  break-inside: avoid;
  padding: 0.3em 0;
  border-bottom: 1px solid rgb(255 255 255 / 0.05);
  color: var(--color-text-body);
  font-size: var(--t-small);
}

.doc dl { margin-top: 1em; }
.doc dt {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--color-accent-light);
  margin-top: 1.2em;
}
.doc dd { margin: 0.4em 0 0; color: var(--color-text-body); }

.doc__person {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: clamp(18px, 3vw, 40px);
  align-items: start;
  padding: clamp(18px, 3vh, 34px) 0;
}
.doc__person img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: grayscale(0.5) contrast(1.08) brightness(0.9);
}

.doc address {
  font-style: normal;
  color: var(--color-text-secondary);
  line-height: 2;
}
.doc a { color: var(--color-accent-light); text-decoration: underline; text-underline-offset: 3px; }

.doc__foot {
  padding-top: clamp(24px, 4vh, 48px);
  font-family: var(--font-meta);
  font-size: var(--t-micro);
  letter-spacing: var(--track-meta);
  text-transform: uppercase;
  color: var(--color-text-faint);
}

@media (max-width: 640px) {
  .doc ul { columns: 1; }
  .doc__person { grid-template-columns: minmax(0, 1fr); }
  .doc__person img { max-width: 240px; }
}

/* ---------- when the experience is running ---------- */
html.js .doc {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- ...until a keyboard reaches it ----------
   The skip link targets it and its links can take focus; hidden, that
   put a focus ring on nothing (Phase 4.8 keyboard walk). While it holds
   focus, or is the skip link's target, it is shown as what it is: the
   written volume, a page over the experience, readable and scrollable.
   Focus leaving it hides it again. CSS only — nothing runs. */
html.js .doc:focus-within,
html.js .doc:target {
  position: fixed;
  inset: 0;
  z-index: 180;
  width: auto;
  height: auto;
  margin: 0;
  padding: clamp(48px, 9vh, 120px) max(var(--gutter), calc((100vw - 78ch) / 2)) clamp(64px, 12vh, 160px);
  overflow: auto;
  clip: auto;
  clip-path: none;
  white-space: normal;
  max-width: none;
  background: var(--color-bg-void);
}

/* ---------- print: only the document ---------- */
@media print {
  html.js .doc {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0 0 24pt;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    max-width: none;
  }
  .doc, .doc p, .doc li, .doc dd, .doc address { color: #111; }
  .doc h1, .doc h2, .doc dt { color: #000; }
  .doc h3 { color: #333; }
  .doc a { color: #000; }
  .doc__sec, .doc__head { border-color: #ccc; }
  .doc__person img { filter: grayscale(1); max-width: 120pt; }
  .doc__mark { width: 90pt; }
}


/* the contact form in the written version (Phase 5.6) */
.doc__formhead { margin-top: 2em; }
.doc__form { max-width: 60ch; margin-top: 1em; }
.doc .cf__l { font-size: var(--t-small); }

/* the first-visit notice: disclaimer and cookies (Phase 5.8, consent.js) */
.notice {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 200;
  width: min(940px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 16px 14px 22px;
  background: rgb(12 10 8 / 0.94);
  box-shadow: inset 0 0 0 1px rgb(214 168 104 / 0.34), 0 24px 60px -20px rgb(0 0 0 / 0.9);
  color: var(--color-text-secondary);
  transform: translate3d(-50%, 18px, 0);
  opacity: 0;
  transition: opacity 500ms var(--ease-editorial), transform 700ms var(--ease-arrive);
}
.notice.is-on { opacity: 1; transform: translate3d(-50%, 0, 0); }
.notice__t { margin: 0; font-size: 0.86rem; line-height: 1.55; }
.notice__t b { color: var(--color-text-primary); font-weight: 400; }
.notice__t a { color: var(--color-accent-light); }
.notice__ok {
  flex: 0 0 auto;
  padding: 12px 18px;
  border: 0;
  background: linear-gradient(160deg, #2c2116, #17110c);
  box-shadow: inset 0 0 0 1px rgb(214 168 104 / 0.55);
  color: var(--color-text-primary);
  font-family: var(--font-meta);
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: var(--track-meta-wide);
  text-transform: uppercase;
  cursor: pointer;
}
.notice__ok:hover, .notice__ok:focus-visible { box-shadow: inset 0 0 0 1px rgb(236 200 140 / 0.95); }
@media (max-width: 720px) {
  .notice { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .notice__t { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) { .notice { transition: none; } }
/* ---------- Dayani AI: the "Ask the Institute" panel (scripts/ask.js) ---------- */
.ask { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 190; font-family: var(--font-body, Georgia, serif); }
.ask__launch {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px 12px 14px; border: 0; cursor: pointer;
  background: linear-gradient(160deg, #2c2116, #15100b); color: var(--color-text-primary, #efe7d6);
  box-shadow: inset 0 0 0 1px rgb(214 168 104 / 0.6), 0 16px 40px -14px rgb(0 0 0 / 0.9);
  font-family: var(--font-meta, Arial, sans-serif); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
}
.ask__launch:hover, .ask__launch:focus-visible { box-shadow: inset 0 0 0 1px rgb(236 200 140 / 0.95), 0 16px 40px -14px rgb(0 0 0 / 0.9); }
.ask__dot { width: 8px; height: 8px; border-radius: 50%; background: #e8c47c; box-shadow: 0 0 10px 2px rgb(232 196 124 / 0.6); }
.ask.is-open .ask__launch { display: none; }
.ask__panel {
  width: min(380px, calc(100vw - 36px)); max-height: min(560px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: rgb(14 11 8 / 0.97); color: var(--color-text-secondary, #cfc6b5);
  box-shadow: inset 0 0 0 1px rgb(214 168 104 / 0.42), 0 30px 80px -24px rgb(0 0 0 / 0.95);
}
.ask__panel[hidden] { display: none; }
.ask__head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 16px 10px 18px; border-bottom: 1px solid rgb(214 168 104 / 0.18); }
.ask__k { font-family: var(--font-meta, Arial, sans-serif); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: #cfae63; }
.ask__t { font-family: var(--font-display, Georgia, serif); font-size: 1.35rem; color: #efe7d6; margin-top: 4px; }
.ask__close { border: 0; background: none; color: #b9b0a0; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.ask__log { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; overscroll-behavior: contain; }
.ask__msg { max-width: 88%; padding: 10px 12px; font-size: 0.92rem; line-height: 1.55; white-space: pre-wrap; }
.ask__msg--ai { align-self: flex-start; background: rgb(255 255 255 / 0.04); box-shadow: inset 0 0 0 1px rgb(214 168 104 / 0.18); }
.ask__msg--me { align-self: flex-end; background: rgb(207 174 99 / 0.16); color: #efe7d6; }
.ask__msg.is-typing { min-width: 46px; min-height: 18px; background-image: radial-gradient(circle, #cfae63 2px, transparent 2.5px); background-size: 12px 100%; background-repeat: repeat-x; background-position: 10px 50%; animation: ask-pulse 1s ease-in-out infinite; }
@keyframes ask-pulse { 50% { opacity: 0.4; } }
.ask__msg.is-error { color: #e7a97f; }
.ask__wa { display: block; margin-top: 6px; color: #cfae63; }
.ask__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.ask__chip { border: 0; cursor: pointer; padding: 6px 10px; background: rgb(255 255 255 / 0.04); color: #cfc6b5; box-shadow: inset 0 0 0 1px rgb(214 168 104 / 0.3); font-family: var(--font-meta, Arial, sans-serif); font-size: 0.68rem; letter-spacing: 0.08em; }
.ask__chip:hover { color: #efe7d6; box-shadow: inset 0 0 0 1px rgb(236 200 140 / 0.8); }
.ask__form { display: flex; gap: 8px; padding: 10px 12px 8px 16px; border-top: 1px solid rgb(214 168 104 / 0.18); }
.ask__in { flex: 1 1 auto; min-width: 0; border: 0; border-bottom: 1px solid rgb(214 168 104 / 0.4); background: transparent; color: #efe7d6; font: inherit; font-size: 16px; padding: 8px 2px; outline: none; }
.ask__go { border: 0; width: 36px; cursor: pointer; background: linear-gradient(160deg, #a8833f, #d8b674); color: #20180f; font-size: 1rem; }
.ask__fine { margin: 0; padding: 0 16px 12px; font-size: 0.68rem; line-height: 1.45; color: #8b8273; }
@media (max-width: 720px) { .ask__lk { display: none; } .ask__launch { padding: 12px; } }
/* phones: the assistant is a sheet the width of the screen, above the
   keyboard's reach, inside the safe area (Dayani Institute) */
@media (max-width: 720px) {
  .ask.is-open { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
  .ask__panel { width: 100%; max-height: min(560px, calc(100dvh - 24px - env(safe-area-inset-top))); }
  .ask__chip, .ask__close, .ask__go { min-height: 40px; min-width: 40px; }
  .notice { width: calc(100% - 16px - env(safe-area-inset-left) - env(safe-area-inset-right)); }
}
