/* ===========================================================================
   OTHELLO  ·  a fine paper edition
   Light, airy, editorial. Ink on warm paper, with a single thread of
   ink-blue and a muted antique rose. Generous air; hairline rules.
   =========================================================================== */

:root {
  --paper:      #faf7f1;   /* warm paper */
  --paper-2:    #fffdf9;   /* raised card */
  --paper-3:    #f3eee3;   /* sunken field */
  --ink:        #1f1b16;   /* near-black brown-ink */
  --ink-soft:   #574f44;   /* secondary text */
  --ink-faint:  #8b8377;   /* captions / muted */
  --indigo:     #2f4a6b;   /* ink-blue accent */
  --indigo-lit: #3c5f88;
  --rose:       #9a4a4f;   /* antique rose (the handkerchief) */
  --line:       rgba(31, 27, 22, 0.14);
  --line-soft:  rgba(31, 27, 22, 0.08);
  --gild:       #b08a3e;   /* faint old-gold for the numeral */
  --shadow:     0 30px 60px -34px rgba(47, 40, 30, 0.32),
                0 2px 6px -2px rgba(47, 40, 30, 0.08);

  --display: "Cinzel", serif;
  --heading: "Cormorant Garamond", "EB Garamond", Georgia, serif;
  --body:    "EB Garamond", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1100px 640px at 50% -6%, rgba(47, 74, 107, 0.06), transparent 60%),
    radial-gradient(900px 600px at 100% 102%, rgba(154, 74, 79, 0.05), transparent 55%),
    linear-gradient(180deg, #fffdf9 0%, var(--paper) 38%, #f6f1e7 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Faint paper-fibre texture (very subtle on light ground) ----------------- */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(47, 74, 107, 0.18); color: var(--ink); }

/* MASTHEAD ---------------------------------------------------------------- */
.masthead {
  text-align: center;
  padding: 13vh 6vw 7vh;
  position: relative;
  animation: rise 1.1s cubic-bezier(.2,.7,.2,1) both;
}
.masthead__eyebrow {
  font-family: var(--display);
  letter-spacing: 0.5em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--indigo);
  margin: 0 0 1.4rem;
  padding-left: 0.5em;
}
.masthead__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(4rem, 16vw, 11rem);
  line-height: 0.9;
  margin: 0;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}
.masthead__subtitle {
  font-family: var(--heading);
  font-style: italic;
  font-size: clamp(1.1rem, 3.4vw, 1.9rem);
  color: var(--ink-soft);
  margin: 0.6rem 0 0;
  letter-spacing: 0.02em;
}
.masthead__rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin: 2.4rem auto 2rem;
  max-width: 360px;
}
.masthead__rule span:not(.diamond) {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}
.diamond { color: var(--gild); font-size: 1rem; }
.masthead__note {
  max-width: 46ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 1.06rem;
}
.masthead__note em { color: var(--rose); font-style: italic; }

/* QUARTO (the stack of acts) --------------------------------------------- */
.quarto {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 5vw 8vh;
  display: flex;
  flex-direction: column;
  gap: 5.5rem;
}

.act {
  position: relative;
  background: linear-gradient(180deg, var(--paper-2), #fcf9f3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: clamp(1.6rem, 4vw, 3rem);
  box-shadow: var(--shadow);
}
/* hairline inner frame */
.act::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  pointer-events: none;
}

.act__header {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  margin-bottom: 1.8rem;
}
.act__numeral {
  font-family: var(--display);
  font-size: 2.6rem;
  color: var(--gild);
  line-height: 1;
  opacity: 0.9;
}
.act__label {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  color: var(--ink);
  margin: 0;
}
.act__label::after {
  content: "";
  display: block;
  margin-top: 0.7rem;
  width: 70px;
  height: 2px;
  background: linear-gradient(90deg, var(--indigo), transparent);
}

/* CONTROL CONSOLE --------------------------------------------------------- */
.act__console {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem 1.6rem;
  margin-bottom: 1.6rem;
}
.control {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem 1.1rem 1.1rem;
  margin: 0;
  background: rgba(255, 255, 255, 0.5);
}
.control legend {
  font-family: var(--heading);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--indigo);
  padding: 0 0.5em;
}
.control__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

/* native select styled as a clean dropdown */
.select-wrap {
  position: relative;
  flex: 1 1 9rem;
  min-width: 8rem;
}
.select-wrap::after {
  content: "\25BE";
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--indigo);
  pointer-events: none;
  font-size: 0.7rem;
}
select.abridge-style,
select.music-style,
.field {
  width: 100%;
  font-family: var(--body);
  font-size: 0.98rem;
  color: var(--ink);
  background: var(--paper-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0.55rem 2rem 0.55rem 0.8rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.field {
  padding-right: 0.8rem;
  margin-top: 0.7rem;
  cursor: text;
  background: var(--paper-2);
}
select option { background: var(--paper-2); color: var(--ink); }
select:focus, .field:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(47, 74, 107, 0.14);
}
.field::placeholder { color: var(--ink-faint); font-style: italic; opacity: 0.85; }

/* BUTTONS ----------------------------------------------------------------- */
.btn {
  font-family: var(--display);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper-2);
  background: linear-gradient(180deg, var(--indigo-lit), var(--indigo));
  border: none;
  border-radius: 3px;
  padding: 0.62rem 1.1rem;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 8px 18px -10px rgba(47, 74, 107, 0.7);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.07); box-shadow: 0 12px 24px -10px rgba(47, 74, 107, 0.6); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: progress; filter: grayscale(0.3); transform: none; }
.btn--ghost {
  background: transparent;
  color: var(--indigo);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn--ghost:hover { background: rgba(47, 74, 107, 0.07); color: var(--indigo); }

/* STATUS + PLAYER --------------------------------------------------------- */
.status {
  min-height: 1.2em;
  margin: 0.3rem 0 0.6rem;
  font-family: var(--heading);
  font-style: italic;
  font-size: 1rem;
  color: var(--rose);
}
.status:empty { margin: 0; min-height: 0; }
.player {
  width: 100%;
  margin: 0 0 1.4rem;
  border-radius: 40px;
}
.player[hidden] { display: none; }

/* THE PLAY TEXT ----------------------------------------------------------- */
.act-text {
  white-space: pre-wrap;            /* functional: preserves the play's line breaks */
  font-family: var(--body);
  font-size: 1.08rem;
  line-height: 1.74;
  color: var(--ink);
  max-height: 60vh;
  overflow-y: auto;
  padding: 1.6rem 1.4rem 1.6rem 1.6rem;
  margin-top: 0.4rem;
  border-top: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.5), transparent 6%),
    repeating-linear-gradient(180deg, transparent, transparent 1.73rem, rgba(47, 74, 107, 0.045) 1.74rem);
  border-radius: 0 0 4px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(47, 74, 107, 0.4) transparent;
}
.act-text::-webkit-scrollbar { width: 9px; }
.act-text::-webkit-scrollbar-thumb { background: rgba(47, 74, 107, 0.32); border-radius: 9px; }
.act-text::-webkit-scrollbar-track { background: transparent; }

/* drop-cap for the opening of each act's text */
.act-text::first-letter {
  font-family: var(--display);
  font-size: 3.1rem;
  line-height: 0.8;
  float: left;
  margin: 0.18rem 0.5rem 0 0;
  color: var(--rose);
}

/* COLOPHON ---------------------------------------------------------------- */
.colophon {
  text-align: center;
  padding: 4vh 6vw 8vh;
  color: var(--ink-faint);
  font-style: italic;
  border-top: 1px solid var(--line-soft);
  max-width: 860px;
  margin: 0 auto;
}
.colophon .diamond { display: block; margin: 0 auto 0.8rem; }
.colophon p { margin: 0; font-size: 0.9rem; }

/* MOTION ------------------------------------------------------------------ */
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* RESPONSIVE -------------------------------------------------------------- */
@media (max-width: 620px) {
  body { font-size: 17px; }
  .act__console { grid-template-columns: 1fr; }
  .masthead { padding-top: 9vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
