/*##############################################################################
# Script:        about.css           (stylesheet, loaded by frontend/pages/about.html)
# Created by:    Matthew Boucher
# Start date:    2026-09-16
# Location:      <project root>/frontend/css/about.css   (main script: <project root>/aiacolyte.py; subscripts: <project root>/subscripts/aiacolyte/)
# Description:   The look of the About us page (The Tale of the Archmage) on top of styles.css and
#                admin.css: the introduction, the chapter list and the buttons on the left, and beside them
#                at the top an ancient tome showing one page at a time: a dark leather cover with blind
#                tooling, brass corners and a clasp, a red ribbon, the gilt edges of the page block, and aged
#                parchment pages with foxing, a darker spine, rubric chapter headings, an illuminated capital,
#                a fleuron and the page number. The turning page is a leaf with a front and a blank back that
#                swings over on the spine with a shadow falling on the page beneath (about.js turns it). On a
#                phone the introduction sits above the tome and the chapter list below it. Works with the main
#                script, which serves it as /static/css/about.css; aiacolyte.py --checkup confirms it is in
#                place.
# Reads:         the tokens and classes of styles.css and admin.css
# Writes:        nothing
# Sensitive:     none needed
# Arguments:     none (a stylesheet cannot take flags)
##############################################################################*/

/* ---------- the layout: the introduction on the left, the tome beside it at the top ---------- */
.tale {
  max-width: 1280px;
}

.tale__layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas: "intro tome" "toc tome" "actions tome";
  column-gap: clamp(28px, 4vw, 56px);
  align-items: start;
}

.tale__intro { grid-area: intro; }
.tale__toc { grid-area: toc; }
.tale__actions { grid-area: actions; }
.tome { grid-area: tome; }

.tale__intro h1 {
  margin-top: 10px;
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1.1;
  color: var(--parchment);
}

.tale__lede {
  margin-top: 14px;
  font-size: 1.2rem;
  color: var(--text-dim);
}

.tale__hint {
  margin-top: 10px;
  font-size: 1rem;
  font-style: italic;
  color: var(--text-dim);
  opacity: 0.8;
}

.tale__toc {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tale__toc-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}

.tale__toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2 180px;
  column-gap: 18px;
}

.tale__toc li {
  break-inside: avoid;
  margin: 0 0 4px;
}

.tale__toc a {
  display: grid;
  grid-template-columns: 2.6em minmax(0, 1fr);   /* a long name wraps beside its numeral, not under it */
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 1.05rem;
  color: var(--text-dim);
  text-decoration: none;
}

.tale__toc a:hover,
.tale__toc a:focus-visible {
  color: var(--parchment);
  background: rgba(227, 176, 75, 0.08);
}

.tale__toc a[aria-current="page"] {
  color: var(--gold);
  background: rgba(227, 176, 75, 0.12);
}

.tale__toc-num {
  font-family: var(--font-display);
  font-size: 0.8em;
  color: var(--gold);
}

.tale__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

/* ---------- the tome: leather cover, brass corners, clasp and ribbon ---------- */
.tome {
  position: relative;
}

.tome:not(.tome-js) .tome-cover {
  display: none;                     /* without scripts the pages simply follow one another */
}

.tome-js .tome-pages {
  display: none;                     /* the pages are shown one at a time inside the cover */
}

.tome-cover {
  position: relative;
  padding: 26px 30px 30px 34px;
  border-radius: 6px 14px 14px 6px;
  background:
    radial-gradient(ellipse at 28% 18%, rgba(255, 196, 130, 0.13), transparent 55%),
    radial-gradient(ellipse at 78% 92%, rgba(0, 0, 0, 0.42), transparent 60%),
    repeating-radial-gradient(circle at 31% 43%, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 6px),
    repeating-linear-gradient(115deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 9px),
    linear-gradient(135deg, #4e1c10, #36120a 55%, #210904);
  box-shadow:
    inset 0 0 0 3px #2a0d06,
    inset 0 0 0 5px rgba(201, 150, 70, 0.55),
    inset 0 0 0 11px #36120a,
    inset 0 0 0 12px rgba(201, 150, 70, 0.3),
    inset 10px 0 18px rgba(0, 0, 0, 0.55),
    0 24px 50px rgba(0, 0, 0, 0.6);
}

.tome-cover::before {                /* the spine: raised bands down the left edge */
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 18px;
  border-radius: 6px 0 0 6px;
  background:
    repeating-linear-gradient(180deg, transparent 0 16%, rgba(201, 150, 70, 0.45) 16% 17%, rgba(0, 0, 0, 0.5) 17% 19%, transparent 19% 33%),
    linear-gradient(90deg, #1c0703, #4a1a0e 60%, #2a0d06);
}

.tome-brass {
  position: absolute;
  z-index: 3;
  width: 44px;
  height: 44px;
  background:
    radial-gradient(circle at 26% 26%, #fff1c2 0 2px, #b88a32 3px, transparent 5px),
    radial-gradient(circle at 34% 30%, #f6db8f, #c4912f 45%, #6e4913 85%);
  clip-path: polygon(0 0, 100% 0, 100% 34%, 34% 34%, 34% 100%, 0 100%);
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.6));
  pointer-events: none;
}

.tome-brass--tl { top: 4px; left: 4px; }
.tome-brass--tr { top: 4px; right: 4px; transform: scaleX(-1); }
.tome-brass--bl { bottom: 4px; left: 4px; transform: scaleY(-1); }
.tome-brass--br { bottom: 4px; right: 4px; transform: scale(-1, -1); }

.tome-clasp {                        /* a brass clasp on the fore-edge */
  position: absolute;
  z-index: 3;
  top: 50%;
  right: -10px;
  width: 26px;
  height: 64px;
  margin-top: -32px;
  border-radius: 4px 8px 8px 4px;
  background:
    radial-gradient(circle at 50% 50%, #3a2508 0 3px, transparent 4px),
    linear-gradient(90deg, #6e4913, #f0d284 40%, #c4912f 70%, #6e4913);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

.tome-ribbon {                       /* the red silk bookmark, its tail hanging out below the pages */
  position: absolute;
  z-index: 0;
  top: calc(100% - 12px);
  right: 24%;
  width: 16px;
  height: 58px;
  background: linear-gradient(90deg, #5c0d08, #a8281c 45%, #7a150d);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 96%, 0 100%);
  filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

/* the page block: the gilt edges of the pages beneath, and room for the page to turn */
.tome-block {
  position: relative;
  overflow: hidden;                  /* the turned page disappears over the spine */
  border-radius: 2px 4px 4px 2px;
  box-shadow: 2px 2px 0 #e9d49a, 4px 4px 0 #d7ba73, 6px 6px 0 #c29b4d, 8px 8px 0 #a57e33, 10px 12px 18px rgba(0, 0, 0, 0.55);
}

.tome-leaves {
  position: relative;
  min-height: 560px;
  perspective: 2200px;
}

.tome-leaves > .tome-page {
  position: absolute;
  inset: 0;
}

/* ---------- a page of the tome: aged parchment ---------- */
.tome-page {
  position: relative;
  padding: 40px clamp(26px, 5%, 58px) 60px;
  color: #3b2a17;
  background:
    radial-gradient(circle at 11% 86%, rgba(122, 72, 22, 0.2) 0 5px, transparent 7px),
    radial-gradient(circle at 83% 12%, rgba(122, 72, 22, 0.14) 0 3px, transparent 5px),
    radial-gradient(circle at 66% 74%, rgba(122, 72, 22, 0.1) 0 10px, transparent 13px),
    radial-gradient(circle at 36% 28%, rgba(122, 72, 22, 0.08) 0 7px, transparent 9px),
    linear-gradient(90deg, rgba(80, 45, 12, 0.42), rgba(80, 45, 12, 0.08) 6%, transparent 12%),
    radial-gradient(ellipse at 55% 50%, transparent 52%, rgba(112, 66, 20, 0.34) 100%),
    linear-gradient(180deg, #f2e3be, #e9d4a4 55%, #efdcb0);
}

.tome-pages .tome-page {             /* without scripts: the pages one after another */
  margin-bottom: 18px;
  border-radius: 3px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.tome-page--verso {                  /* the blank back of a turning page, the ink showing through */
  height: 100%;
  background:
    repeating-linear-gradient(180deg, transparent 0 22px, rgba(60, 35, 10, 0.05) 22px 24px),
    linear-gradient(270deg, rgba(80, 45, 12, 0.4), transparent 10%),
    radial-gradient(ellipse at 45% 50%, transparent 50%, rgba(112, 66, 20, 0.34) 100%),
    linear-gradient(180deg, #ecdcb3, #e2cb98 55%, #e9d5a8);
}

.page-chapter {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-align: center;
  color: #4a2c12;
}

.page-chapter-num {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #8c2217;                    /* rubric red, as in old manuscripts */
}

.page-chapter::after {
  content: "\2767";                  /* a fleuron */
  display: block;
  margin-top: 8px;
  font-size: 1.1rem;
  color: #8c2217;
}

.tome-page p {
  max-width: 60ch;
  margin: 0 auto 7px;
  font-family: var(--font-body);
  font-size: 1.14rem;
  line-height: 1.42;
  color: #3b2a17;
}

.page-chapter + p::first-letter {    /* the illuminated capital */
  float: left;
  margin: 5px 10px 0 0;
  padding: 6px 9px 4px;
  font-family: var(--font-display);
  font-size: 3.1em;
  font-weight: 700;
  line-height: 0.85;
  color: #7a1a10;
  background: linear-gradient(135deg, #f7df95, #d2a042 55%, #946719);
  border: 2px solid #6e4913;
  border-radius: 3px;
  box-shadow: inset 0 0 0 2px rgba(255, 244, 205, 0.55);
}

.tome-page .page-number {
  position: absolute;
  right: 0;
  bottom: 22px;
  left: 0;
  margin: 0;
  max-width: none;
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  text-align: center;
  color: #8a5a2b;
}

.tome-page .page-number::before { content: "\2014\2002"; }
.tome-page .page-number::after { content: "\2002\2014"; }

/* the title page and the closing page */
.tome-page--title,
.tome-page--end {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
}

.tome-page .tome-page__kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #8c2217;
}

.tome-page__booktitle {
  margin: 0;
  max-width: 12em;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  color: #4a2c12;
}

.tome-page .tome-page__finis {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-style: italic;
  letter-spacing: 0.12em;
  color: #4a2c12;
}

.tome-sigil {
  width: 96px;
  height: 78px;
  fill: none;
  stroke: #9a6a24;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tome-sigil__star {
  fill: #8c2217;
  stroke: none;
}

/* ---------- the turning page ---------- */
.tome-leaf {
  position: absolute;
  inset: 0;
  z-index: 5;
  transform-origin: left center;     /* it turns on the spine */
  transform-style: preserve-3d;
}

.tome-leaf__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
}

.tome-leaf__face > .tome-page {
  height: 100%;
}

.tome-leaf__back {
  transform: rotateY(180deg);
}

.tome-leaf__face::after {            /* the page darkens as it turns away from the light */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(40, 20, 5, 0) 0%, rgba(40, 20, 5, 0.45) 100%);
  opacity: 0;
}

.tome-leaf.is-forward {
  animation: tome-turn-forward 0.9s linear forwards;
}

.tome-leaf.is-backward {
  animation: tome-turn-back 0.9s linear forwards;
}

.tome-leaf.is-forward .tome-leaf__front::after { animation: tome-shade-in 0.9s ease-in forwards; }
.tome-leaf.is-backward .tome-leaf__front::after { animation: tome-shade-out 0.9s ease-out forwards; }

.tome-leaves.is-turning::after {     /* the shadow of the lifted page falling on the page beneath */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(30, 14, 3, 0.45), rgba(30, 14, 3, 0) 40%);
  animation: tome-shadow 0.9s ease-in-out forwards;
}

/* most of the turn is spent while the page still faces the reader (0 to 90 degrees), so the turn can be seen */
@keyframes tome-turn-forward {
  0% { transform: rotateY(0deg); }
  20% { transform: rotateY(-14deg) translateZ(8px); }
  70% { transform: rotateY(-82deg) translateZ(4px); }
  100% { transform: rotateY(-180deg); }
}

@keyframes tome-turn-back {
  0% { transform: rotateY(-180deg); }
  30% { transform: rotateY(-98deg) translateZ(4px); }
  80% { transform: rotateY(-14deg) translateZ(8px); }
  100% { transform: rotateY(0deg); }
}

@keyframes tome-shade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tome-shade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes tome-shadow { 0% { opacity: 0; } 45% { opacity: 1; } 100% { opacity: 0; } }

/* the curled page corners: click one to turn the page */
.tome-corner {
  position: absolute;
  bottom: 0;
  z-index: 6;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  font-size: 24px;
  font-weight: 700;
  color: #5b371a;
  cursor: pointer;
  transition: width 0.2s, height 0.2s;
}

.tome-corner--next {
  right: 0;
  background: linear-gradient(135deg, transparent 0 49%, #cdb27a 50%, #f3e4c0 78%, #d9c08a 100%);
  filter: drop-shadow(-3px -3px 4px rgba(0, 0, 0, 0.35));
}

.tome-corner--prev {
  left: 0;
  background: linear-gradient(225deg, transparent 0 49%, #cdb27a 50%, #f3e4c0 78%, #d9c08a 100%);
  filter: drop-shadow(3px -3px 4px rgba(0, 0, 0, 0.35));
}

.tome-corner span {
  position: absolute;
  bottom: 6px;
}

.tome-corner--next span { right: 12px; }
.tome-corner--prev span { left: 12px; }

.tome-corner:hover,
.tome-corner:focus-visible {
  width: 76px;
  height: 76px;
}

/* the controls under the tome: brass buttons and where the reader is */
.tome-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 18px;
  margin-top: 26px;
}

.tome-btn {
  padding: 9px 18px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #2a1604;
  background: linear-gradient(180deg, #f5d98c, #d2a042 55%, #9c6d1f);
  border: 1px solid #6e4913;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 246, 214, 0.7), 0 3px 8px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.tome-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.tome-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.tome-where {
  min-width: 10em;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-align: center;
  color: var(--text-dim);
}

/* measuring how tall every page is (about.js), off screen */
.tome-measure {
  position: absolute;
  top: 0;
  left: -10000px;
  visibility: hidden;
}

.tome-measure > .tome-page {
  min-height: 0;
}

/* ---------- smaller screens: the introduction above the tome, the chapter list below it ---------- */
@media (max-width: 900px) {
  .tale__layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "intro" "tome" "toc" "actions";
  }

  .tome {
    margin-top: 24px;
  }

  .tale__hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .tome-cover { padding: 16px 16px 20px 22px; }
  .tome-cover::before { width: 12px; }
  .tome-brass { width: 30px; height: 30px; }
  .tome-clasp { display: none; }
  .tome-ribbon { right: 16%; width: 12px; height: 44px; }
  .tome-page { padding: 34px 18px 58px; }
  .tome-leaves { min-height: 420px; }
  .tome-corner { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .tome-leaf,
  .tome-leaf__face::after,
  .tome-leaves.is-turning::after { animation: none !important; }
}

/*##############################################################################
# End of about.css
##############################################################################*/
