/* Homepage entrance: the edition is the door, examination is the first room.
   The chat workspace (.app) now sits below the fold — reached by "Begin an
   examination" — so the first paint is the primary text and a worked
   examination, never the assistant shell. Edition faces (EB Garamond +
   Gentium Book Plus for Greek) are scoped to this page; the rest of the site
   keeps its current serif until the system is carried to Library and About. */

html,
body {
  background: var(--paper) !important;
}

.page {
  display: flex;
  flex-direction: column;
  width: min(100%, var(--shell-curriculum)) !important;
  max-width: var(--shell-curriculum) !important;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: none !important;
  overflow: clip;

  --serif-ed: "EB Garamond", Georgia, "Times New Roman", serif;
  --greek-ed: "Gentium Book Plus", "EB Garamond", Georgia, serif;
}

/* ---------- masthead: the charcoal frame ---------- */
.ed-masthead {
  order: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(16px, 3vw, 40px);
  flex-wrap: wrap;
  padding: 15px clamp(22px, 4vw, 40px);
  background: var(--charcoal);
  color: #e9e2d4;
}

.ed-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.ed-seal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 33%;
  flex: none;
  filter: grayscale(1) contrast(1.06) brightness(1.05);
  box-shadow: inset 0 0 0 1px rgba(184, 168, 120, 0.3);
}

.ed-wordmark {
  margin: 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #e9e2d4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ed-nav {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(16px, 2.6vw, 26px);
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: #b6ac98;
}

.ed-nav a {
  color: #b6ac98;
  padding: 4px 1px;
  border-bottom: 1px solid transparent;
}

.ed-nav a:hover {
  color: #efe8d8;
  border-bottom-color: var(--bronze-soft);
}

/* Current page = a non-link marker, not a self-referential link. */
.ed-nav [aria-current="page"] {
  color: #efe8d8;
  font-weight: 500;
  cursor: default;
}

/* ---------- the door: an edition opening ---------- */
.ed-door {
  order: 0;
  padding: clamp(40px, 6vw, 78px) clamp(26px, 7vw, 92px) clamp(30px, 4vw, 48px);
  background: var(--paper);
}

.ed-folio {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: clamp(30px, 5vw, 52px);
}

/* Keep each label whole (never break "Chapter I" mid-phrase). */
.ed-folio span {
  white-space: nowrap;
}

.ed-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(30px, 6vw, 72px);
  align-items: start;
}

.ed-greek {
  margin: 0;
  font-family: var(--greek-ed);
  font-weight: 400;
  font-size: clamp(1.6rem, 3.9vw, 2.3rem);
  line-height: 1.5;
  color: var(--ink);
}

/* An enlarged versal in the same ink as the Greek — a manuscript initial,
   not a recolored letter. Rendered inline (no float) so Τῶν stays one word. */
.ed-drop {
  font-size: 1.5em;
  line-height: inherit;
  font-weight: 600;
  color: var(--ink);
}

.ed-en h2 {
  margin: 0;
  font-family: var(--serif-ed);
  font-weight: 500;
  font-size: clamp(1.4rem, 3.2vw, 1.9rem);
  line-height: 1.32;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-wrap: balance;
}

.ed-en p {
  margin: 18px 0 0;
  font-family: var(--serif-ed);
  font-size: 1.06rem;
  line-height: 1.7;
  color: var(--ink-secondary);
}

.ed-attrib {
  font-family: var(--sans) !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  letter-spacing: 0.04em;
  color: var(--muted) !important;
}

.ed-act {
  display: flex;
  align-items: center;
  gap: clamp(20px, 3vw, 28px);
  flex-wrap: wrap;
  margin-top: clamp(32px, 5vw, 54px);
  padding-top: clamp(26px, 4vw, 38px);
  border-top: 1px solid var(--line);
}


/* Keep the two calls paired so a mid-width wrap never splits them. */
.ed-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(18px, 2.5vw, 26px);
}

.ed-begin,
.ed-open {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
}

.ed-begin {
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-control);
  background: var(--ink);
  color: var(--paper);
}

.ed-begin:hover {
  background: transparent;
  color: var(--ink);
}

.ed-open {
  display: inline;
  min-height: 0;
  padding: 8px 0;
  color: var(--bronze);
  border-bottom: 0;
  /* A real text underline hugs the words, unlike a full-box border. */
  text-decoration: underline;
  text-decoration-color: rgba(142, 94, 36, 0.5);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.ed-open:hover {
  text-decoration-color: var(--bronze);
}

/* ---------- transition band ---------- */
.ed-band {
  order: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  margin: clamp(18px, 3vw, 28px) 0;
  padding: 0 clamp(26px, 7vw, 92px);
}

.ed-band::before,
.ed-band::after {
  content: "";
  height: 1px;
  background: var(--line);
  flex: 1;
}

.ed-band::before {
  flex: 0 0 24px;
}

.ed-band span {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- the first room: examination specimen ---------- */
.ed-room {
  order: 0;
  /* Shares the door's horizontal measure so the book reads as one page. */
  padding: clamp(14px, 2.4vw, 24px) clamp(26px, 7vw, 92px) clamp(38px, 5vw, 60px);
  background: var(--paper);
}

/* One left-aligned reading column at the same left edge and measure as the door. */
.ed-room-inner {
  max-width: 42em;
}

.ed-room-ref {
  margin: 0 0 16px;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.ed-room-text {
  margin: 0;
  font-family: var(--serif-ed);
  /* Quieter than the quotation: interpretation must never out-shout the text. */
  font-size: clamp(1.02rem, 1.9vw, 1.16rem);
  line-height: 1.68;
  color: var(--ink);
}

.ed-room-text .lead {
  font-size: 1.1em;
  line-height: 1.5;
}

.ed-room-text em {
  font-style: italic;
  color: var(--ink);
}

.ed-room-cite {
  margin: 20px 0 0;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: var(--muted);
}

.ed-room-act {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-top: clamp(28px, 4vw, 40px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.ed-room-act p {
  flex: 1;
  min-width: 200px;
  margin: 0;
  font-family: var(--serif-ed);
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}

/* ---------- canon strip: the texts as first-class objects, hairline ---------- */
.ed-canon {
  order: 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: clamp(18px, 3vw, 32px);
  padding: clamp(6px, 1.4vw, 12px) clamp(26px, 7vw, 92px) clamp(20px, 3vw, 28px);
  border-bottom: 1px solid var(--line);
}

.ed-canon-label {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.ed-canon a {
  font-family: var(--serif-ed);
  font-size: 1.05rem;
  color: var(--ink);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.ed-canon a:hover {
  border-bottom-color: var(--bronze);
}

.ed-canon a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- keep the workspace + footer below ---------- */
.app {
  order: 2;
  margin-top: clamp(12px, 2vw, 22px) !important;
  scroll-margin-top: 22px;
  /* The inert workspace is not the hero: a hairline border, never a SaaS lift. */
  box-shadow: none;
}

/* Below-fold chrome shares the edition measure; inline legacy margins stay overridden. */
.page > .app {
  margin-inline: 0 !important;
}

.app-footer {
  order: 3;
  margin: 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--line) !important;
  padding: clamp(28px, 4vw, 36px) clamp(26px, 7vw, 92px) clamp(24px, 3vw, 32px) !important;
  background: var(--paper) !important;
  grid-template-columns: 1.15fr repeat(4, minmax(0, 1fr)) !important;
  gap: 24px 20px !important;
}

.legal {
  order: 4;
  margin: 0 !important;
  border: 0 !important;
  border-top: 1px solid var(--line) !important;
  padding: 14px clamp(26px, 7vw, 92px) 18px !important;
  background: var(--paper) !important;
  color: var(--muted) !important;
}

.legal-right {
  gap: 18px !important;
}

/* ---------- focus visibility ---------- */
.ed-nav a:focus-visible,
.ed-brand:focus-visible,
.ed-begin:focus-visible,
.ed-open:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .ed-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    background: var(--paper) !important;
  }

  .page {
    width: 100% !important;
    box-shadow: none !important;
  }

  .ed-masthead {
    padding: 12px 16px;
    gap: 10px 18px;
  }

  .ed-nav {
    width: 100%;
    justify-content: space-between;
    gap: 4px clamp(10px, 3vw, 20px);
    font-size: 11.5px;
    letter-spacing: 0.04em;
  }

  .ed-door {
    padding: clamp(30px, 7vw, 46px) 18px clamp(24px, 5vw, 32px);
  }

  .ed-band {
    padding-inline: 18px;
  }

  /* The canon shares the 18px gutter; the label takes its own line so the three
     named texts sit together instead of orphaning "Library" onto a line alone. */
  .ed-canon {
    padding-inline: 18px;
    gap: 6px clamp(14px, 4vw, 20px);
  }

  .ed-canon-label {
    flex-basis: 100%;
  }

  .ed-room {
    padding: 14px 18px clamp(32px, 7vw, 48px);
  }

  .app {
    margin-top: 14px !important;
    padding-inline: 18px !important;
    border-top-color: rgba(99, 82, 60, 0.18);
    box-shadow: none;
  }

  .app-footer {
    padding: 26px 18px 22px !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 22px 16px !important;
  }

  .legal {
    padding: 14px 18px 16px !important;
  }

  .legal-right {
    margin-left: 0 !important;
    width: 100%;
    gap: 14px !important;
  }

  .center {
    height: min(62svh, 560px) !important;
    max-height: min(62svh, 560px) !important;
  }

  .center-top {
    height: 40px !important;
    flex-basis: 40px !important;
    justify-content: flex-start !important;
    padding-inline: 16px !important;
  }

  .center-top::before {
    display: none !important;
  }

  .center-top span {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .conversation {
    padding: 14px 18px 14px !important;
  }

  .conversation h2 {
    font-size: 1.35rem !important;
    line-height: 1.1;
  }
}

@media (max-width: 420px) {
  .ed-nav {
    font-size: 11px;
    letter-spacing: 0.02em;
  }

  .ed-wordmark {
    font-size: 11px;
    letter-spacing: 0.14em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ed-nav a,
  .ed-begin,
  .ed-open {
    transition: none;
  }
}
