/* Oração em Dia: the app's tokens (Shared/Core/Palette.swift) and the pieces every page shares. */
:root {
  --cream: #f6eee4;
  --card: #fbf6ef;
  --paper: #fffaf3;
  --sage: #7e9c84;
  --sage-light: #e4ece3;
  --sage-dark: #4a6552;
  --sage-deep: #3c5344;
  --teal: #7fa9a3;
  --peach: #f2a48c;
  --blush: #e9b3a6;
  --amber: #f4c77b;
  --flame: #f0a04b;
  --ink: #2e3a3a;
  --ink-soft: #56625f;
  --hairline: #e6dccf;
  --night: #1c2430;
  --night-deep: #131a24;
  --night-ink: #f5eee4;
  --night-soft: #c3c8cb;

  /* SF Pro Rounded on Apple devices, like the app's widget and timers. No fonts to download. */
  --font-ui: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Scripture always speaks in a book face: New York on Apple devices. */
  --font-scripture: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --step--1: clamp(0.875rem, 0.85rem + 0.12vw, 0.95rem);
  --step-0: clamp(1rem, 0.97rem + 0.18vw, 1.1rem);
  --step-1: clamp(1.18rem, 1.1rem + 0.4vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.28rem + 0.85vw, 1.95rem);
  --step-3: clamp(2rem, 1.55rem + 2.2vw, 3.4rem);
  --step-4: clamp(2.6rem, 1.8rem + 4vw, 5.25rem);
  --step-5: clamp(3.6rem, 2.1rem + 7.6vw, 8.75rem);

  --radius-small: 0.75rem;
  --radius: 1.25rem;
  --radius-large: 1.75rem;
  --radius-pill: 999px;
  --shadow-soft: 0 1.4rem 2.6rem -1.4rem rgba(120, 92, 62, 0.34);
  --shadow-card: 0 0.7rem 1.4rem -0.8rem rgba(201, 184, 164, 0.7), 0 -1px 0 rgba(255, 255, 255, 0.8) inset;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --wrap: 74rem;
  --gutter: clamp(1rem, 4.2vw, 2.75rem);
  --header-height: 4.25rem;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-height) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--sage-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

:focus-visible {
  outline: 3px solid var(--sage-dark);
  outline-offset: 3px;
  border-radius: 0.5rem;
}

[data-theme="night"] :focus-visible,
.site-header.is-night :focus-visible {
  outline-color: var(--amber);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-small);
  background: var(--ink);
  color: var(--card);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

.wrap {
  width: min(var(--wrap), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.25rem;
  padding: 0.85rem 1.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: var(--step-0);
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
  transition:
    transform 0.25s var(--ease-out),
    background-color 0.25s ease,
    box-shadow 0.25s ease,
    color 0.25s ease;
}

.button:active {
  transform: scale(0.97);
}

.button--primary {
  background: var(--sage-dark);
  color: #fff;
  box-shadow: 0 0.9rem 1.6rem -0.9rem rgba(74, 101, 82, 0.9);
}

.button--primary:hover {
  background: var(--sage-deep);
  transform: translateY(-2px);
}

.button--quiet {
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px rgba(46, 58, 58, 0.14);
}

.button--quiet:hover {
  background: rgba(255, 255, 255, 0.85);
}

.button--small {
  min-height: 2.6rem;
  padding: 0.55rem 1.1rem;
  font-size: var(--step--1);
}

.button[aria-disabled="true"],
.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

/* Apple's own badge artwork, unmodified, as the App Store marketing guidelines require:
   at least 40 px tall, with a quarter of its height kept clear around it. */
.store-badge {
  display: inline-block;
  flex: none;
  line-height: 0;
  border-radius: 0.6rem;
}

.store-badge img {
  width: auto;
  height: 3.25rem;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  transition:
    background-color 0.35s ease,
    box-shadow 0.35s ease,
    color 0.35s ease,
    transform 0.4s var(--ease-out);
}

.site-header.is-scrolled {
  background: rgba(246, 238, 228, 0.78);
  box-shadow: 0 1px 0 rgba(46, 58, 58, 0.08);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}

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

.site-header.is-night.is-scrolled {
  background: rgba(19, 26, 36, 0.72);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.site-header__bar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: var(--header-height);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-right: auto;
  color: inherit;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.55rem;
  box-shadow: 0 0.4rem 0.8rem -0.4rem rgba(46, 58, 58, 0.5);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  font-weight: 650;
}

.site-nav a {
  position: relative;
  color: inherit;
  opacity: 0.78;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.3rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease-out);
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  opacity: 1;
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.menu-button {
  display: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  color: inherit;
}

.site-header.is-night .menu-button {
  background: rgba(255, 255, 255, 0.1);
}

.menu-button svg {
  width: 1.3rem;
  height: 1.3rem;
}

.menu-button line {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  transition: transform 0.35s var(--ease-out), opacity 0.2s ease;
  transform-origin: 12px 12px;
}

.menu-button[aria-expanded="true"] line:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.menu-button[aria-expanded="true"] line:nth-child(2) {
  opacity: 0;
}

.menu-button[aria-expanded="true"] line:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* The page burns like a candle as you read: the wick shortens with the scroll. */
.reading-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  pointer-events: none;
}

.reading-progress i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--peach), var(--amber));
  transform: scaleX(var(--reading-progress, 0));
  transform-origin: left;
}

.reading-progress i::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-radius: 50%;
  background: #fff3c4;
  box-shadow: 0 0 10px 3px rgba(244, 199, 123, 0.9);
  opacity: min(1, calc(var(--reading-progress, 0) * 40));
}

@media (max-width: 56rem) {
  .menu-button {
    display: grid;
  }

  .header-cta {
    display: none;
  }

  .site-nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem var(--gutter) 1.5rem;
    background: rgba(246, 238, 228, 0.97);
    box-shadow: 0 1.5rem 2rem -1rem rgba(46, 58, 58, 0.25);
    color: var(--ink);
    font-size: 1.25rem;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-0.75rem);
    transition:
      opacity 0.25s ease,
      transform 0.35s var(--ease-out),
      visibility 0s linear 0.35s;
  }

  .site-nav a {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--hairline);
    opacity: 1;
  }

  .site-nav a::after {
    display: none;
  }

  .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition:
      opacity 0.25s ease,
      transform 0.35s var(--ease-out);
  }
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 3.5rem 3rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.site-footer--night {
  background: var(--night-deep);
  color: var(--night-soft);
}

.site-footer__top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 2rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--hairline);
}

.site-footer--night .site-footer__top {
  border-color: rgba(255, 255, 255, 0.1);
}

.site-footer .brand {
  margin: 0;
  color: var(--ink);
}

.site-footer--night .brand {
  color: var(--night-ink);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  font-weight: 650;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.site-footer p {
  max-width: 62ch;
  margin-top: 0.4rem;
}

/* ---------- Candle (built by candle.js from CandleView.swift) ---------- */
.candle-host {
  position: relative;
}

/* The host is the candle's frame; the drawing is larger so the glow can spill out. */
.candle-host > .candle-svg {
  position: absolute;
  left: -30%;
  top: -50%;
  width: 160%;
  max-width: none;
  height: 160%;
  overflow: visible;
  pointer-events: none;
}

.candle-svg .candle-glow,
.candle-svg .candle-flame,
.candle-svg .candle-z,
.candle-svg .eyes-open,
.candle-svg .eyes-closed,
.candle-svg .candle-smile,
.candle-svg .candle-blush {
  transform-box: fill-box;
  transition:
    transform 0.8s var(--ease-out),
    opacity 0.6s ease;
}

.candle-svg .candle-glow {
  transform-origin: center;
  transform: scale(var(--glow-scale, 0.8));
  opacity: var(--glow-opacity, 0.75);
}

.candle-svg .candle-flame {
  transform-origin: 50% 100%;
  transform: rotate(var(--lean, 0deg)) scale(1, var(--flame-height, 0.87));
}

.candle-svg .flame-flicker,
.candle-svg .glow-breathe {
  transform-box: fill-box;
}

.candle-svg .flame-flicker {
  transform-origin: 50% 100%;
}

.candle-svg .glow-breathe {
  transform-origin: center;
}

.candle-svg .eyes-closed,
.candle-svg .candle-z {
  opacity: 0;
}

.candle-svg[data-state="unlit"] {
  --glow-opacity: 0;
  --glow-scale: 0.3;
}

.candle-svg[data-state="unlit"] .candle-flame {
  opacity: 0;
  transform: scale(0.2);
}

.candle-svg[data-state="unlit"] .eyes-open,
.candle-svg[data-state="unlit"] .candle-smile,
.candle-svg[data-state="unlit"] .candle-blush {
  opacity: 0;
}

.candle-svg[data-state="unlit"] .eyes-closed,
.candle-svg[data-state="unlit"] .candle-z {
  opacity: 1;
}

.candle-svg[data-state="lit"] {
  --glow-scale: 0.59;
  --glow-opacity: 0.5;
  --flame-height: 0.73;
}

.candle-svg[data-state="radiant"] {
  --glow-scale: 0.8;
  --glow-opacity: 0.75;
  --flame-height: 0.87;
}

.candle-svg[data-state="blazing"] {
  --glow-scale: 1;
  --glow-opacity: 0.95;
  --flame-height: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .candle-svg:not([data-still]) .flame-flicker {
    animation: flicker 3.2s ease-in-out infinite;
  }

  .candle-svg:not([data-still]) .glow-breathe {
    animation: breathe 3.2s ease-in-out infinite;
  }

  .candle-svg[data-state="unlit"] .candle-z {
    animation: snooze 2.8s ease-in-out infinite;
  }
}

@keyframes flicker {
  0%,
  100% {
    transform: scale(1.04, 0.97);
  }

  50% {
    transform: scale(0.94, 1.05);
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.97);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes snooze {
  0% {
    opacity: 0;
    transform: translate(0, 4px) scale(0.8);
  }

  30%,
  70% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(6px, -10px) scale(1.1);
  }
}

/* ---------- Legal and support pages ---------- */
.document-page {
  background:
    radial-gradient(60rem 26rem at 85% -8rem, rgba(244, 199, 123, 0.22), transparent 70%),
    radial-gradient(50rem 24rem at -10% 0, rgba(127, 169, 163, 0.18), transparent 70%),
    var(--cream);
}

.document {
  max-width: 44rem;
  padding-block: calc(var(--header-height) + 3rem) 4rem;
}

.document h1 {
  font-size: var(--step-4);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 0.75rem;
}

.document .updated {
  margin-bottom: 2.5rem;
  color: var(--ink-soft);
  font-size: var(--step-1);
}

.document h2 {
  margin: 2.6rem 0 0.7rem;
  font-size: var(--step-2);
  font-weight: 750;
}

.document p,
.document li {
  line-height: 1.7;
}

.document p + p {
  margin-top: 0.9rem;
}

.document ul {
  padding-left: 1.2rem;
}

.document li {
  margin-bottom: 0.45rem;
}

.document li::marker {
  color: var(--sage);
}

.contact {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 2.25rem;
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius-large);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.contact svg {
  flex: none;
  width: 2rem;
  height: 2rem;
  color: var(--sage-dark);
}

/* Questions open smoothly where the browser can animate to an automatic height. */
.faq-item {
  border-bottom: 1px solid var(--hairline);
  interpolate-size: allow-keywords;
}

.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 0;
  font-size: var(--step-1);
  font-weight: 700;
  line-height: 1.3;
  list-style: none;
  cursor: pointer;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "";
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.3rem;
  border-right: 2.5px solid var(--sage-dark);
  border-bottom: 2.5px solid var(--sage-dark);
  transform: translateY(-0.2rem) rotate(45deg);
  transition: transform 0.35s var(--ease-out);
}

.faq-item[open] summary::after {
  transform: translateY(0.15rem) rotate(-135deg);
}

.faq-item::details-content {
  block-size: 0;
  overflow: hidden;
  transition:
    block-size 0.4s var(--ease-out),
    content-visibility 0.4s allow-discrete;
}

.faq-item[open]::details-content {
  block-size: auto;
}

.faq-item p {
  padding-bottom: 1.3rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* The 404: a candle that went out on the way. */
.lost {
  display: grid;
  justify-items: start;
  gap: 1.25rem;
}

.lost .lost-candle {
  width: 12rem;
  aspect-ratio: 1;
  margin: 1rem 0 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
