/* Holy Hour — holyhour.app
   The app's own two palettes: the Night Office (dark) for the home page,
   the vellum page (light) for documents. Cormorant Garamond speaks as the
   app; EB Garamond is kept for the words of a prayer (DESIGN.md's
   Two-Voice Rule). */

:root {
  /* Night Office (src/theme.ts darkColors) */
  --night: #110d0a;
  --night-raised: #1c1611;
  --night-line: #2e251c;
  --night-ink: #f2ebdd;
  --night-ink-soft: #cbbea9;
  --night-ink-muted: #a89a83;
  --night-accent: #d8564c;

  /* Vellum page (src/theme.ts lightColors) */
  --page: #efe1c7;
  --page-raised: #fff8e8;
  --page-line: #dac69c;
  --ink: #2e2a22;
  --ink-muted: #6e6353;
  --oxblood: #8c1f1f;
  --gold-text: #7c5c1b;

  --gold: #e3bc72;
  --gold-deep: #ad7e1f;

  --chrome: 'Cormorant Garamond', Georgia, serif;
  --prayer: 'EB Garamond', Georgia, serif;

  --gutter: clamp(20px, 5vw, 64px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: clip;
  font-family: var(--chrome);
  font-size: 1.25rem;
  line-height: 1.5;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

figure {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-weight: 600;
  text-wrap: balance;
  margin: 0;
}

p {
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: var(--gutter);
  top: 12px;
  z-index: 10;
  background: var(--night-raised);
  color: var(--night-ink);
  padding: 8px 14px;
}

/* ---------- Header ---------- */

.site-header {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.site-nav {
  display: flex;
  gap: clamp(14px, 3vw, 28px);
  font-style: italic;
  font-size: 1.125rem;
}
.site-nav a {
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 200ms var(--ease-out);
}
.site-nav a:hover,
.site-nav a[aria-current='page'] {
  opacity: 1;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

/* ---------- Home (Night Office) ---------- */

.night {
  background: var(--night);
  color: var(--night-ink);
}
.night .site-header {
  color: var(--night-ink);
}

/* Hero: the painting is the page. Text sits in the dark the painting
   already has to its left. */
.hero {
  position: relative;
  min-height: min(100svh, 980px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
}

.hero-art {
  overflow: hidden;
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  position: relative;
}
.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}
/* The painting's own dark ground carried across into the page. */
.hero-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--night) 0%, rgba(17, 13, 10, 0.55) 22%, rgba(17, 13, 10, 0) 48%),
    linear-gradient(0deg, var(--night) 0%, rgba(17, 13, 10, 0) 26%);
}

.hero-copy {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 1;
  padding: 140px var(--gutter) 96px;
  max-width: 640px;
  justify-self: end;
}

.hero h1 {
  font-size: clamp(3rem, 6.4vw, 5.75rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
}
.hero h1 em {
  font-style: italic;
  font-weight: 500;
  color: var(--gold);
}

.lede {
  margin: 28px 0 0;
  font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  line-height: 1.45;
  color: var(--night-ink-soft);
  max-width: 30ch;
}

.availability {
  margin-top: 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  border: 1px solid rgba(227, 188, 114, 0.6);
  border-radius: 10px;
  color: var(--gold);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.badge svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.quiet-link {
  font-style: italic;
  color: var(--night-ink-soft);
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

/* One prayer, one page */
.page-turn {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(48px, 8vw, 120px);
  align-items: center;
  padding: clamp(96px, 12vw, 168px) var(--gutter);
  max-width: 1240px;
  margin: 0 auto;
}

.section-title {
  font-size: clamp(2.25rem, 4.2vw, 3.5rem);
  line-height: 1.05;
}
.section-title em {
  font-style: italic;
  font-weight: 500;
  color: var(--gold);
}

.prose {
  margin-top: 24px;
  max-width: 34ch;
  color: var(--night-ink-soft);
  font-size: 1.3125rem;
  line-height: 1.55;
}
.prose p {
  margin: 0 0 1em;
}

/* Where the prayers come from: no AI-written prayers, ever. Set plainly,
   centered, between the opening painting and the rest. */
.handed-down {
  max-width: 780px;
  margin: 0 auto;
  /* The same space above and below (neither neighbour adds any of its own). */
  padding: clamp(72px, 12vw, 96px) var(--gutter);
  text-align: center;
}
@media (min-width: 861px) {
  .handed-down {
    padding-top: clamp(104px, 9vw, 136px);
    padding-bottom: clamp(104px, 9vw, 136px);
  }
}
.handed-rule {
  width: 1px;
  height: 56px;
  margin: 0 auto 36px;
  background: linear-gradient(180deg, rgba(227, 188, 114, 0), var(--gold));
}
.handed-down > p {
  margin: 24px auto 0;
  max-width: 44ch;
  font-size: 1.375rem;
  line-height: 1.55;
  color: var(--night-ink-soft);
}
.handed-down > .handed-plain {
  margin-top: 18px;
  color: var(--night-ink);
  font-weight: 600;
}
/* The app itself, in a plain phone frame: a dark bezel with a hairline of
   gold, nothing more. Screenshots are 1179x2556, saved at half size. */
.phone {
  position: relative;
  margin: 0;
  padding: 9px;
  border-radius: 46px;
  background: #050403;
  box-shadow:
    0 0 0 1px rgba(227, 188, 114, 0.28),
    0 40px 90px -40px rgba(0, 0, 0, 0.9);
}
.phone img {
  width: 100%;
  height: auto;
  aspect-ratio: 1179 / 2556;
  border-radius: 37px;
}
.phone-solo {
  width: min(100%, 330px);
  justify-self: center;
}

/* A row of the app's screens. On a phone, a row you swipe sideways. */
/* Sections alternate between the night and a raised band. A band on a
   max-width section reaches the page edges through its shadow, clipped to
   the section's own height. */
.band {
  background: var(--night-raised);
  box-shadow: 0 0 0 100vmax var(--night-raised);
  clip-path: inset(0 -100vmax);
}
.gallery {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(96px, 12vw, 168px) var(--gutter);
}
.phones {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 44px);
  align-items: start;
}
.phones li:nth-child(even) {
  margin-top: 64px;
}
.phones p {
  margin: 22px 4px 0;
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--night-ink-soft);
  text-wrap: pretty;
}

/* The library's contents, set like the table of contents at the front of
   a missal. */
.contents {
  position: relative;
  background: var(--night-raised);
  border-top: 1px solid var(--night-line);
  border-bottom: 1px solid var(--night-line);
}
.contents-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(40px, 6vw, 96px);
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(64px, 8vw, 112px) var(--gutter);
}
/* Paintings are shown whole, never cropped, with their credit beneath. */
.art-frame {
  overflow: hidden;
}
.contents-art img {
  display: block;
  width: 100%;
  height: auto;
}
.contents-art figcaption,
.credit {
  margin-top: 14px;
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--night-ink-muted);
}
.toc {
  list-style: none;
  margin: 36px 0 0;
  padding: 0;
  columns: 2 15rem;
  column-gap: 40px;
}
.toc li {
  break-inside: avoid;
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--night-line);
  font-size: 1.1875rem;
  line-height: 1.3;
}
.toc .n {
  flex: none;
  width: 2.2em;
  font-style: italic;
  color: var(--gold);
  font-size: 0.95em;
}
.toc-note {
  margin: 28px 0 0;
  font-style: italic;
  color: var(--night-ink-muted);
  font-size: 1.125rem;
}

/* And more besides */
.within {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(96px, 12vw, 168px) var(--gutter);
}
.within-grid {
  margin-top: 56px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 48px clamp(32px, 4vw, 56px);
}
.within-grid h3 {
  font-size: 1.625rem;
  line-height: 1.15;
  font-weight: 600;
}
.within-grid h3::before {
  content: '';
  display: block;
  width: 28px;
  height: 1px;
  background: var(--gold);
  margin-bottom: 18px;
}
.within-grid p {
  margin: 10px 0 0;
  color: var(--night-ink-soft);
  font-size: 1.1875rem;
  line-height: 1.5;
}

/* The offer, plainly. The words sit beneath the painting, never across
   it -- nothing is written over Christ. */
.offer {
  text-align: center;
  padding: clamp(96px, 12vw, 160px) 0;
}
/* The whole painting, uncropped, hung in the middle of the page. */
.offer-art {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.offer-art img {
  display: block;
  width: 100%;
  height: auto;
}
.offer-copy {
  position: relative;
  max-width: 620px;
  margin: clamp(48px, 6vw, 80px) auto 0;
  padding: 0 var(--gutter);
}
@media (max-width: 640px) {
  .offer-art {
    padding: 0;
  }
  .offer-art .credit {
    padding: 0 var(--gutter);
  }
}
.offer-copy p {
  margin: 22px auto 0;
  max-width: 36ch;
  font-size: 1.375rem;
  line-height: 1.5;
  color: var(--night-ink-soft);
}
.offer .availability {
  justify-content: center;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--night-line);
  background: var(--night);
  color: var(--night-ink-muted);
  padding: 40px var(--gutter) 48px;
  font-size: 1.0625rem;
}
.footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}
.footer-links a {
  color: var(--night-ink-soft);
  font-style: italic;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.footer-art {
  font-style: italic;
  font-size: 0.9375rem;
  max-width: 60ch;
}

/* ---------- Documents (vellum page) ---------- */

.vellum {
  background: var(--page);
  color: var(--ink);
}
.vellum .site-header {
  position: static;
  color: var(--ink);
  border-bottom: 1px solid var(--page-line);
}
.vellum .site-nav a:hover,
.vellum .site-nav a[aria-current='page'] {
  color: var(--oxblood);
}

.doc {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(56px, 8vw, 96px) var(--gutter) 120px;
}
.doc h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  line-height: 1.05;
}
.doc .updated {
  margin: 12px 0 0;
  font-style: italic;
  color: var(--ink-muted);
  font-size: 1.0625rem;
}
.doc .rule {
  width: 48px;
  height: 1px;
  background: var(--gold-deep);
  margin: 32px 0 36px;
}
.doc h2 {
  font-size: 1.75rem;
  line-height: 1.15;
  margin: 52px 0 12px;
  color: var(--oxblood);
}
.doc h3 {
  font-size: 1.3125rem;
  margin: 28px 0 6px;
}
.doc p,
.doc li {
  font-size: 1.25rem;
  line-height: 1.6;
}
.doc p {
  margin: 0 0 1em;
}
.doc ul {
  padding-left: 1.2em;
  margin: 0 0 1em;
}
.doc li {
  margin-bottom: 0.35em;
}
.doc li::marker {
  color: var(--gold-deep);
}
.doc a {
  color: var(--oxblood);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.doc strong {
  font-weight: 700;
}
.summary {
  background: var(--page-raised);
  border: 1px solid var(--page-line);
  border-radius: 10px;
  padding: 22px 26px;
}
.summary p:last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 8px 0 1.2em;
}
.doc table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 1.125rem;
  line-height: 1.45;
}
.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--page-line);
}
.doc th {
  font-weight: 700;
}

/* Placeholders still to be filled in before launch. */
.todo {
  background: #f1dede;
  color: var(--oxblood);
  padding: 0 4px;
  border-radius: 3px;
  font-style: italic;
}

.faq details {
  border-bottom: 1px solid var(--page-line);
  padding: 4px 0;
}
.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  flex: none;
  font-weight: 400;
  color: var(--oxblood);
  transition: transform 260ms var(--ease-out);
}
.faq details[open] summary::after {
  transform: rotate(45deg);
}
.faq details > div {
  padding: 0 0 16px;
}

.contact-card {
  margin: 8px 0 8px;
  padding: 26px 28px;
  background: var(--page-raised);
  border: 1px solid var(--page-line);
  border-radius: 10px;
}
.contact-card p {
  margin: 0;
}
.contact-card .email {
  display: inline-block;
  margin-top: 6px;
  font-size: 1.625rem;
  font-weight: 600;
}

.vellum .site-footer {
  background: var(--page);
  border-top-color: var(--page-line);
  color: var(--ink-muted);
}
.vellum .footer-links a {
  color: var(--ink);
}

/* ---------- Motion ---------- */

/* Paintings emerge from the dark, the way a painting in a side chapel
   appears as your eyes adjust: brightness and focus come up together,
   the canvas settles, and then everything is still. Once each, never on a
   loop, nothing tied to the scroll. */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes emerge {
  from {
    opacity: 0;
    filter: brightness(0.25);
    scale: 1.05;
  }
  60% {
    opacity: 1;
  }
  to {
    opacity: 1;
    filter: brightness(1);
    scale: 1;
  }
}

.hero-art img {
  animation: emerge 2800ms var(--ease-out) both;
}
.hero-copy > * {
  animation: rise 1100ms var(--ease-out) both;
}
.hero-copy > :nth-child(1) {
  animation-delay: 500ms;
}
.hero-copy > :nth-child(2) {
  animation-delay: 680ms;
}
.hero-copy > :nth-child(3) {
  animation-delay: 840ms;
}

/* Below the fold: main.js adds .motion to <html> and .is-visible to each
   [data-reveal] as it comes into view. Without the script nothing is ever
   hidden. */
.motion [data-reveal='art'] img {
  opacity: 0;
  filter: brightness(0.25);
  scale: 1.05;
  transition:
    opacity 1600ms var(--ease-out),
    filter 2600ms var(--ease-out),
    scale 3200ms var(--ease-out);
}
.motion [data-reveal='art'] figcaption {
  opacity: 0;
  transition: opacity 1200ms var(--ease-out) 1400ms;
}
.motion [data-reveal='art'].is-visible img {
  opacity: 1;
  filter: brightness(1);
  scale: 1;
}
.motion [data-reveal='art'].is-visible figcaption {
  opacity: 1;
}

/* The app's screens rise into place, one after another. */
.motion [data-reveal='phone'],
.motion [data-reveal='phones'] li {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 1200ms var(--ease-out),
    transform 1600ms var(--ease-out);
}
.motion [data-reveal='phone'].is-visible,
.motion [data-reveal='phones'].is-visible li {
  opacity: 1;
  transform: none;
}
.motion [data-reveal='phones'].is-visible li:nth-child(2) {
  transition-delay: 150ms;
}
.motion [data-reveal='phones'].is-visible li:nth-child(3) {
  transition-delay: 300ms;
}
.motion [data-reveal='phones'].is-visible li:nth-child(4) {
  transition-delay: 450ms;
}

/* The gold line draws down, then the words come after it. */
.motion [data-reveal='lines'] .handed-rule {
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 1100ms var(--ease-out);
}
.motion [data-reveal='lines'] > :not(.handed-rule) {
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 1000ms var(--ease-out),
    transform 1000ms var(--ease-out);
}
.motion [data-reveal='lines'].is-visible .handed-rule {
  transform: none;
}
.motion [data-reveal='lines'].is-visible > :not(.handed-rule) {
  opacity: 1;
  transform: none;
}
.motion [data-reveal='lines'].is-visible > :nth-child(2) {
  transition-delay: 500ms;
}
.motion [data-reveal='lines'].is-visible > :nth-child(3) {
  transition-delay: 750ms;
}
.motion [data-reveal='lines'].is-visible > :nth-child(4) {
  transition-delay: 1150ms;
}

@media (prefers-reduced-motion: reduce) {
  .hero-art img,
  .hero-copy > * {
    animation: none;
  }
  .faq summary::after {
    transition: none;
  }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 860px) {
  /* On phones the headings are centered, so the words beneath them are too,
     and every section gets the same, shorter space above and below. */
  .section-title,
  .prose,
  .phones p,
  .within-grid,
  .toc-note,
  .contents-art figcaption {
    text-align: center;
  }
  .prose {
    margin-left: auto;
    margin-right: auto;
  }
  .within-grid h3::before {
    margin-left: auto;
    margin-right: auto;
  }
  .gallery,
  .page-turn,
  .within,
  .contents-inner {
    padding-top: 72px;
    padding-bottom: 72px;
  }
  .gallery {
    padding-bottom: 48px; /* the phone strip adds 24px of its own */
  }
  .offer {
    padding-top: 72px;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    min-height: 0;
  }
  .hero-art {
    grid-column: 1;
    grid-row: 1;
    height: 72svh;
    max-height: 640px;
  }
  .hero-art::after {
    background: linear-gradient(0deg, var(--night) 0%, rgba(17, 13, 10, 0.35) 30%, rgba(17, 13, 10, 0) 55%),
      linear-gradient(180deg, rgba(17, 13, 10, 0.7) 0%, rgba(17, 13, 10, 0) 22%);
  }
  .hero-copy {
    grid-column: 1;
    grid-row: 2;
    justify-self: stretch;
    margin-top: -120px;
    padding: 0 var(--gutter) 24px;
  }
  .page-turn {
    grid-template-columns: minmax(0, 1fr);
  }
  .phones {
    display: flex;
    gap: 18px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-left: calc(var(--gutter) * -1);
    margin-right: calc(var(--gutter) * -1);
    padding: 4px var(--gutter) 24px;
    scrollbar-width: none;
  }
  .phones::-webkit-scrollbar {
    display: none;
  }
  .phones li {
    flex: 0 0 68%;
    scroll-snap-align: center;
  }
  .phones li:nth-child(even) {
    margin-top: 0;
  }
  .contents-inner {
    grid-template-columns: minmax(0, 1fr);
  }
  .contents-art {
    max-width: 440px;
    margin: 0 auto;
  }
  .site-nav .hide-narrow {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand span {
    font-size: 1.375rem;
  }
  .site-nav {
    font-size: 1.0625rem;
  }
}
