/* ==========================================================================
   COMPONENTS — reusable pieces used across sections
   (buttons, navigation, logo mark, chapter labels, arches, pies,
    the "Today, handled" card, marquee, olive branches)
   ========================================================================== */

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  padding: 1.05em 1.7em;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: background-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn .icon { transition: transform var(--dur-fast) var(--ease-out); }
.btn:hover .icon { transform: translateX(4px); }
.btn:active { transform: scale(0.98); }

.btn--primary {
  --btn-bg: var(--clay);
  --btn-fg: #FFF8F1;
  box-shadow: 0 10px 24px -12px rgba(176, 78, 56, 0.7);
}
.btn--primary:hover { --btn-bg: var(--ink); }

/* a slow sun-glint that sweeps across the primary button */
.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 236, 214, 0.38) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: glint 7s var(--ease-inout) 3s infinite;
}

.btn--ghost {
  --btn-fg: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover { --btn-bg: var(--ink); --btn-fg: var(--paper); border-color: var(--ink); }

.btn--light {
  --btn-bg: var(--on-night);
  --btn-fg: var(--ink);
}
.btn--light:hover { --btn-bg: #fff; }

.btn--sm { padding: 0.75em 1.25em; font-size: 0.86rem; }

/* underlined text link with arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  color: var(--ink);
  font-weight: 500;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: 0.2em;
  transition: background-size var(--dur) var(--ease-out), color var(--dur-fast);
}
.link-arrow:hover { color: var(--clay); background-size: 0% 1px; background-position: 100% 100%; }

/* ---- Logo mark (the "fraction": a circle with its quarter pulled out) ---- */
.mark { overflow: visible; }
.mark__base  { fill: var(--blush); }
.mark__slice {
  fill: var(--coral);
  transform-box: view-box;
  transform-origin: 48px 52px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
}
.brand__mark { width: 2.15rem; height: 2.15rem; }
.brand__word {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand__word span { color: var(--coral); }

/* ---- Navigation ------------------------------------------------------------ */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 60;
  height: var(--nav-h);
  transition: background-color 0.5s var(--ease-out), backdrop-filter 0.5s;
}
.nav.is-scrolled {
  background: rgba(252, 246, 239, 0.8);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
}
/* over the night-time footer the glass turns dark */
.nav.is-night { background: rgba(31, 28, 38, 0.72); }
.nav.is-night .brand,
.nav.is-night .nav__link,
.nav.is-night .nav__clock { color: var(--on-night); }
.nav.is-night .mark__base { fill: #EADBCB; }
.nav.is-night .nav__horizon { background: rgba(246, 235, 221, 0.15); }
.brand, .nav__link, .nav__clock { transition: color 0.5s; }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  height: 100%;
}
.nav__links {
  display: none;
  gap: clamp(1.25rem, 2vw, 2.25rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav__link {
  position: relative;
  color: var(--ink-soft);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color var(--dur-fast);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -0.35rem;
  height: 1px;
  background: var(--clay);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out);
}
.nav__link:hover { color: var(--ink); }
.nav__link:hover::after { transform: scaleX(1); transform-origin: left; }

.nav__right { display: flex; align-items: center; gap: 1.5rem; }

/* the little clock that tells the time of the "day" you're scrolling through */
.nav__clock {
  display: none;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.nav__clock .icon { color: var(--coral); font-size: 1rem; }

/* the horizon line + sun: a scroll progress indicator */
.nav__horizon {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--line);
  opacity: 0;
  transition: opacity 0.5s;
}
.nav.is-scrolled .nav__horizon { opacity: 1; }
.nav__trail {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(237, 123, 101, 0), var(--coral));
  transform-origin: left;
  transform: scaleX(var(--progress, 0));
}
.nav__sun {
  position: absolute;
  top: -4px;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(237, 123, 101, 0.16), 0 0 16px 4px rgba(237, 123, 101, 0.45);
  transform: translateX(calc(var(--progress, 0) * (100vw - 9px)));
}

@media (min-width: 960px) {
  .nav__links { display: flex; }
}
@media (min-width: 1240px) {
  .nav__clock { display: inline-flex; }
}
@media (max-width: 420px) {
  .brand__word { font-size: 1.45rem; }
  .brand__mark { width: 1.85rem; height: 1.85rem; }
  .nav .btn--sm { padding: 0.7em 1em; font-size: 0.8rem; }
}

/* ---- Chapter label: the time of day that opens each section --------------- */
.chapter {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: clamp(1.25rem, 1rem + 1vw, 2rem);
  color: var(--ink-muted);
}
.chapter__time {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-style: italic;
  font-weight: 500;
  color: var(--clay);
  white-space: nowrap;
}
.chapter__rule {
  width: clamp(1.5rem, 3vw, 3rem);
  height: 1px;
  background: currentColor;
  opacity: 0.45;
}

/* ---- Arch frame (echoes the terrace columns in the photography) ---------- */
/* .arch carries the shadow + reveal; .arch__frame carries the arch shape.
   (Kept separate because Chrome drops rounded clipping when one element
   has both a clip-path animation and border-radius + overflow.) */
.arch {
  position: relative;
  border-radius: var(--arch);
}
.arch__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--blush);
  clip-path: inset(0 round 999px 999px 0 0);
  isolation: isolate;
}
.arch__frame > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.arch-outline {
  position: absolute;
  border: 1px solid var(--coral);
  border-bottom: 0;
  border-radius: var(--arch);
  pointer-events: none;
  opacity: 0.55;
}

/* ---- Fraction pie (same geometry as the logo) ---------------------------- */
.pie { overflow: visible; }
.pie__rest  { fill: var(--blush); }
.pie__slice { fill: var(--coral); }
.pie__ring  { fill: none; stroke: var(--line-strong); stroke-width: 0.6; stroke-dasharray: 1.5 2.5; }

/* Typeset fraction, e.g. 1/4 */
.frac { display: inline-flex; align-items: flex-start; font-family: var(--font-display); line-height: 1; }
.frac__num { font-size: 0.62em; }
.frac__slash { font-size: 1em; margin: 0 0.02em; font-weight: 300; transform: translateY(-0.04em); }
.frac__den { font-size: 0.62em; align-self: flex-end; }

/* ---- Check list item --------------------------------------------------------- */
.ticks { display: grid; gap: 0.7rem; margin: 0; padding: 0; list-style: none; }
.ticks li { display: flex; gap: 0.75rem; align-items: flex-start; color: var(--ink); }
.ticks .icon { margin-top: 0.3em; color: var(--coral); stroke-width: 2; }

/* ---- "Today, handled" card ---------------------------------------------------- */
.taskcard {
  width: min(19rem, 80vw);
  padding: 1.05rem 1.2rem 0.9rem;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-paper);
  color: var(--ink-soft);
}
.taskcard__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.55rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px dashed var(--line-strong);
}
.taskcard__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
}
.taskcard__list {
  position: relative;
  height: 7.8rem;           /* exactly three rows */
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}
.task {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  height: 2.6rem;
  font-size: 0.86rem;
  line-height: 1.25;
  overflow: hidden;
  transition: height 0.6s var(--ease-out), opacity 0.5s var(--ease-out), transform 0.6s var(--ease-out);
}
.task__text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.5s; }
.task__check {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.2rem;
  height: 1.2rem;
  border: 1.4px solid var(--line-strong);
  border-radius: 50%;
  color: #fff;
  transition: background-color 0.4s var(--ease-out), border-color 0.4s;
}
.task__check svg { width: 0.7rem; height: 0.7rem; }
.task__check path {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.45s var(--ease-out) 0.15s;
}
.task.is-done .task__check { background: var(--coral); border-color: var(--coral); }
.task.is-done .task__check path { stroke-dashoffset: 0; }
.task.is-done .task__text { color: var(--ink-muted); }
.task.is-leaving { height: 0; opacity: 0; transform: translateY(-8px); }
.task.is-entering { opacity: 0; transform: translateY(12px); }

.taskcard__foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.6rem;
  margin-top: 0.2rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.taskcard__foot .mark { width: 1rem; height: 1rem; }

/* ---- Marquee -------------------------------------------------------------------- */
.marquee {
  position: relative;
  overflow: hidden;
  padding-block: clamp(1.5rem, 1rem + 2vw, 2.6rem);
  border-block: 1px solid var(--line);
  background: var(--sky-noon);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee 70s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__group {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
  padding-right: clamp(1.25rem, 2.5vw, 2.5rem);
  margin: 0;
  list-style: none;
}
.marquee__item {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 400;
  color: var(--ink);
  white-space: nowrap;
  line-height: 1.1;
}
.marquee__item:nth-child(4n + 1) { font-style: italic; color: var(--clay); }
.marquee__leaf { width: 1.3rem; height: 1.3rem; color: var(--sage); flex: none; }

/* ---- Olive branches ----------------------------------------------------------- */
/* Soft, swaying shadows cast across the "plaster wall" */
.leafshadows {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.leafshadow {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  color: #4E3B2A;
  opacity: var(--o, 0.12);
  filter: blur(var(--blur, 5px));
  mix-blend-mode: multiply;
  transform: rotate(var(--rot, 0deg));
  transform-origin: 0% 50%;
  animation: sway var(--dur, 9s) var(--ease-inout) var(--delay, 0s) infinite alternate;
  will-change: transform;
}
.leafshadow svg { width: 100%; height: auto; }

/* Hand-drawn line art that draws itself in */
.olive-line { color: var(--sage); overflow: visible; }
.olive-line path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
