/* =========================================================
   THE ORACLE ARCHIVE
   Stellar Visione
   ========================================================= */


/* =========================================================
   1. VARIABLES
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --fg: #f4f1ea;
  --muted: #8d8d8d;
  --line: rgba(255, 255, 255, 0.17);
  --accent: #ff2f92;

  --pad: clamp(20px, 4vw, 64px);
  --small: 0.73rem;
}


/* =========================================================
   2. GLOBAL STYLES
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Helvetica, Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
select {
  font: inherit;
}


/* =========================================================
   3. TOP NAVIGATION
   ========================================================= */

.topbar {
  position: fixed;
  z-index: 20;
  inset: 0 0 auto;

  display: flex;
  justify-content: space-between;

  padding: 18px var(--pad);

  mix-blend-mode: difference;
  color: white;
}

.brand,
.return {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}


/* =========================================================
   4. ORACLE HERO
   ========================================================= */

.oracle-hero {
  min-height: 100svh;

  padding: 110px var(--pad) 42px;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  border-bottom: 1px solid var(--line);
}

.eyebrow,
.detail-label,
.panel-title,
label,
.result-count {
  font-size: var(--small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.oracle-hero h1 {
  margin: auto 0;

  font-size: clamp(5rem, 15vw, 14rem);
  line-height: 0.72;
  letter-spacing: -0.085em;
}

.hero-bottom {
  display: flex;
  justify-content: space-between;
  align-items: end;

  gap: 40px;

  font-size: 0.8rem;
  letter-spacing: 0.1em;
  line-height: 1.45;
}


/* =========================================================
   5. ARCHIVE FILTERS
   ========================================================= */

.controls {
  position: sticky;
  top: 0;
  z-index: 10;

  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 1px;

  background: rgba(10, 10, 10, 0.94);
  backdrop-filter: blur(12px);

  border-bottom: 1px solid var(--line);
}

.controls > div,
.controls button {
  padding: 15px var(--pad);
  border-right: 1px solid var(--line);
}

.controls label {
  display: block;
  margin-bottom: 7px;
}

.controls select {
  width: 100%;

  border: 0;
  outline: none;

  background: transparent;
  color: var(--fg);
}

.controls select option {
  background: #111;
  color: var(--fg);
}

.controls button {
  border: 0;

  background: transparent;
  color: var(--accent);

  cursor: pointer;

  font-size: 0.72rem;
  letter-spacing: 0.1em;
}


/* =========================================================
   6. MAIN SECTIONS
   ========================================================= */

.stats,
.archive {
  padding: clamp(70px, 10vw, 150px) var(--pad);
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 18px 0 55px;

  font-size: clamp(4rem, 10vw, 10rem);
  line-height: 0.78;
  letter-spacing: -0.07em;
}


/* =========================================================
   7. MAIN STAT CARDS
   ========================================================= */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);

  border: 1px solid var(--line);
}

.stat-card {
  min-height: 220px;
  padding: 24px;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  background: transparent;
  color: var(--fg);

  border: 0;
  border-right: 1px solid var(--line);

  text-align: left;
  cursor: pointer;
}

.stat-card:last-child {
  border-right: 0;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.035);
}

.stat-value {
  font-size: clamp(3rem, 7vw, 7rem);
  letter-spacing: -0.07em;
}

.stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}


/* =========================================================
   8. DETAILED STATISTICS
   ========================================================= */

.stat-detail-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 0.8fr;
  gap: 1px;

  margin-top: 1px;

  background: var(--line);
}

.panel {
  min-height: 300px;
  padding: 30px;

  background: var(--bg);
}


/* Most frequent cards */

.rank-row,
.bar-row {
  display: grid;
  grid-template-columns: 1fr auto;

  gap: 20px;

  padding: 11px 0;

  border-bottom: 1px solid var(--line);

  font-size: 0.9rem;
}

.rank-row button {
  padding: 0;

  border: 0;
  background: transparent;

  color: inherit;

  text-align: left;
  cursor: pointer;
}

.rank-row button:hover {
  color: var(--accent);
}


/* Distribution bars */

.bar-row {
  grid-template-columns: 120px 1fr 45px;
  align-items: center;
}

.bar-track {
  height: 7px;
  background: rgba(255, 255, 255, 0.1);
}

.bar-fill {
  height: 100%;
  background: var(--fg);
}


/* Cards not yet seen */

.big-inline {
  margin: 35px 0 10px;

  font-size: clamp(5rem, 9vw, 9rem);
  letter-spacing: -0.08em;
}

.small-copy {
  color: var(--muted);
  line-height: 1.5;
}


/* =========================================================
   9. ARCHIVE HEADER
   ========================================================= */

.archive-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
}

.archive-head .eyebrow {
  grid-column: 1 / -1;
}

.archive-head h2 {
  margin-bottom: 30px;
}

.result-count {
  margin-bottom: 40px;
  text-align: right;
}


/* =========================================================
   10. READING LIST
   ========================================================= */

.reading {
  border-top: 1px solid var(--line);
}

.reading-summary {
  width: 100%;

  display: grid;
  grid-template-columns: minmax(150px, 20vw) 1fr 30px;
  gap: 30px;
  align-items: center;

  padding: 25px 0;

  background: transparent;
  color: var(--fg);

  border: 0;

  text-align: left;
  cursor: pointer;
}

.reading-date {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
}

.reading-cards {
  font-size: clamp(1rem, 2vw, 1.7rem);
  letter-spacing: -0.025em;
}

.reversed {
  color: var(--accent);
}

.reading-toggle {
  font-size: 1.5rem;
  text-align: right;
}


/* =========================================================
   11. EXPANDED READING
   ========================================================= */

.reading-detail {
  padding: 10px 0 55px min(20vw, 240px);
}

.detail-grid {
  display: grid;

  /* Interpretation gets more room than the other columns */
  grid-template-columns: 0.9fr 1.5fr 0.9fr;

  gap: 45px;
}

.detail-grid p:not(.detail-label) {
  font-family: "Times New Roman", Times, serif;
  font-size: 1.18rem;
  line-height: 1.5;
}


/* Preserve paragraphs in interpretation and hindsight */

.reading-interpretation,
.reading-later {
  white-space: pre-wrap;
  text-align: justify;
  line-height: 1.6;
}


/* =========================================================
   12. EMPTY STATE
   ========================================================= */

.empty-state {
  padding: 70px 0;

  font-size: 2rem;
  color: var(--muted);
}


/* =========================================================
   13. MOBILE
   ========================================================= */

@media (max-width: 760px) {

  .return {
    display: none;
  }

  .hero-bottom {
    display: block;
  }

  .hero-bottom p + p {
    margin-top: 25px;
  }


  /* Filters */

  .controls {
    position: relative;
    grid-template-columns: 1fr;
  }

  .controls > div,
  .controls button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }


  /* Stats */

  .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-card:nth-child(2) {
    border-right: 0;
  }

  .stat-card {
    min-height: 170px;
    border-bottom: 1px solid var(--line);
  }

  .stat-detail-grid {
    grid-template-columns: 1fr;
  }


  /* Archive */

  .archive-head {
    display: block;
  }

  .result-count {
    text-align: left;
  }


  /* Reading rows */

  .reading-summary {
    grid-template-columns: 1fr 30px;
  }

  .reading-date {
    grid-column: 1;
  }

  .reading-cards {
    grid-column: 1;
  }

  .reading-toggle {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .card-type {
  color: var(--muted);
  font-size: 0.65em;
  letter-spacing: 0.08em;
}

.additional-card-display {
  opacity: 0.8;
}


  /* Expanded reading */

  .reading-detail {
    padding-left: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}