/*
 * Verse Explorer - ITEC100 reference project A.
 * One stylesheet, no build step, no framework.
 *
 * This project is text, so the design is typography, paper and space rather
 * than motion and glow. Compare it with project E, which is the opposite
 * problem solved the opposite way - both are the right answer to their own
 * content.
 */

:root {
  /* Ink and paper. The warm off-white matters: pure #fff under a serif reads
     as a screenshot of a document, and this should read as something to sit
     and look at. */
  --paper:        #fbfaf7;
  --card:         #ffffff;
  --ink:          #14243d;
  --ink-strong:   #0b1626;
  --text:         #21283a;
  --muted:        #6b7385;
  --rule:         #e6e2d9;
  --rule-strong:  #cfc9bb;
  --gold:         #d8a830;
  --gold-deep:    #8a6206;

  /* One colour per theme. Six passages of Comfort should be visible as a
     group from across the page, before a word is read. */
  --t-creation: #3f7d6a;
  --t-comfort:  #4a6fa5;
  --t-hope:     #b3782a;
  --t-love:     #a84f63;
  --t-prayer:   #6a5a9c;
  --t-wisdom:   #6d7a3c;

  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--card);
  padding: .6rem 1rem;
  border-radius: 8px;
}

/* --- Masthead ------------------------------------------------------------
   A deep ground with two soft lights and a hairline gold rule at the foot.
   The rule is the only ornament and it does a job: it separates the title
   from the working part of the page.                                       */
.masthead {
  position: relative;
  color: #f2efe7;
  padding: 3.2rem 0 2.6rem;
  background:
    radial-gradient(760px 300px at 12% -30%, rgba(216,168,48,.16), transparent 60%),
    radial-gradient(680px 320px at 88% -10%, rgba(74,111,165,.22), transparent 62%),
    linear-gradient(160deg, var(--ink) 0%, var(--ink-strong) 100%);
  border-bottom: 3px solid var(--gold);
}

/* Paper grain over the gradient, faint enough to feel rather than see. */
.masthead::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/theme-texture.png") center / auto 100% repeat-x;
  opacity: .14;
  mix-blend-mode: overlay;
  pointer-events: none;
}

.masthead > .wrap { position: relative; }

/* Optional illustration, added by app.js once it has loaded. */
.masthead__art {
  position: absolute;
  right: max(1rem, calc((100% - 1100px) / 2));
  bottom: 1.6rem;
  width: min(440px, 42%);
  height: auto;
  pointer-events: none;
}
.masthead.has-art .lede { max-width: min(46ch, 52%); }
@media (max-width: 760px) {
  .masthead__art { display: none; }
  .masthead.has-art .lede { max-width: 46ch; }
}

.eyebrow {
  margin: 0 0 .55rem;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
}

.masthead h1 {
  margin: 0 0 .7rem;
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5.5vw, 3.4rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.lede {
  margin: 0;
  max-width: 46ch;
  color: rgba(242,239,231,.72);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* --- Controls ------------------------------------------------------------
   Lifted over the masthead's edge, so the page reads as one object rather
   than three stacked bands.                                                */
.controls {
  /* Lifted over the masthead's edge so the page reads as one object rather
     than three stacked bands. `position` and `z-index` are load-bearing: the
     masthead is itself positioned, so without them it paints over this panel
     and clips the field labels. */
  position: relative;
  z-index: 1;
  display: grid;
  gap: .9rem 1.1rem;
  grid-template-columns: 1fr;
  margin: -1.7rem auto 1.6rem;
  padding: 1.15rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px -24px rgba(11,22,38,.5);
}
@media (min-width: 860px) {
  /* The two selects are fixed-width; search takes what is left, and the
     checkbox and Clear sit together on the end rather than each fighting for
     a column of their own. */
  .controls {
    grid-template-columns: minmax(0, 1fr) 11rem 11rem auto;
    align-items: end;
  }
  .field--inline { justify-self: end; white-space: nowrap; }
}
@media (min-width: 560px) and (max-width: 859px) {
  .controls { grid-template-columns: 1fr 1fr; }
  .controls > .field:first-child { grid-column: 1 / -1; }
}

.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > span, .field > label:not(.check) {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field--inline {
  flex-direction: row;
  align-items: center;
  gap: .55rem;
  padding-bottom: .15rem;
}
.field--inline span, .field--inline label { text-transform: none; letter-spacing: 0; font-size: .88rem; }

input[type="search"], select {
  font: inherit;
  padding: .55rem .75rem;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  min-width: 0;
}
input[type="search"]:focus, select:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  background: var(--card);
}

/* `.check` is the label wrapping the box and its words, not the box itself.
   Sizing the label to 1.05rem squashed it and threw the text across the
   Clear button. */
.check {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .88rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.check:hover { color: var(--text); }
.check input[type="checkbox"] {
  accent-color: var(--gold-deep);
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex: none;
  cursor: pointer;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  padding: .42rem .95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .08s ease;
}
.btn:hover { background: var(--ink-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn--quiet {
  background: transparent;
  color: var(--muted);
  border-color: var(--rule-strong);
}
.btn--quiet:hover { background: var(--paper); color: var(--text); border-color: var(--muted); }

/* Saving is the one thing this tool is *for*, so the saved state is the one
   place colour is spent. */
.btn--save { background: transparent; color: var(--gold-deep); border-color: var(--gold); }
.btn--save:hover { background: rgba(216,168,48,.12); }
.card--saved .btn--save {
  background: var(--gold);
  border-color: var(--gold);
  color: #2a1f04;
}

/* --- Status line -------------------------------------------------------- */
.status {
  margin: 0 0 1rem;
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* --- Cards -------------------------------------------------------------- */
.results {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  padding-bottom: 3rem;
  list-style: none;
  margin: 0;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 1.15rem 1.2rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(11,22,38,.04);
  transition: transform .14s ease, box-shadow .18s ease, border-color .14s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--rule-strong);
  box-shadow: 0 14px 30px -18px rgba(11,22,38,.45);
}

/* The theme stripe. Four pixels of colour down the spine is enough to group
   thirty-six cards by eye, and it costs no space. */
.card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--theme-colour, var(--rule-strong));
}
.card[data-theme="Creation"] { --theme-colour: var(--t-creation); }
.card[data-theme="Comfort"]  { --theme-colour: var(--t-comfort); }
.card[data-theme="Hope"]     { --theme-colour: var(--t-hope); }
.card[data-theme="Love"]     { --theme-colour: var(--t-love); }
.card[data-theme="Prayer"]   { --theme-colour: var(--t-prayer); }
.card[data-theme="Wisdom"]   { --theme-colour: var(--t-wisdom); }

.card--saved {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(216,168,48,.35), 0 10px 26px -18px rgba(138,98,6,.5);
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
}

.card__ref {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
}

.card__theme {
  flex: none;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .2rem .5rem;
  border-radius: 999px;
  color: var(--theme-colour, var(--muted));
  background: color-mix(in srgb, var(--theme-colour, #888) 12%, transparent);
}

.card__theme img {
  width: 1.15rem;
  height: 1.15rem;
  margin: -.2rem .3rem -.25rem -.15rem;
  vertical-align: middle;
}

/* The passage itself: serif, generous leading, and a size that invites
   reading rather than scanning. It is the reason the page exists. */
.card__text {
  margin: 0;
  flex: 1;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.62;
  color: var(--text);
}

.card__actions { display: flex; gap: .5rem; margin-top: .2rem; }

/* --- Empty state -------------------------------------------------------- */
.empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  background: var(--card);
}

/* --- Foot --------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--rule);
  padding: 1.4rem 0 2.4rem;
  color: var(--muted);
  font-size: .85rem;
}
.muted { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
