/* Jagatud stiilid — "Täna" kaart, "Selle aasta tähtpäevad" ja modaalid.
   Kasutavad nii index.html kui ka app.html (koduekraani rakendus), et kaardi
   muutmine ühes kohas muudaks seda kõikjal. Lehespetsiifiline kujundus (hero,
   KKK, jalus) jääb vastava lehe sisemisse <style> plokki. */

:root {
  /* Flexoki light — https://stephango.com/flexoki */
  --paper:    #FFFCF0;   /* paper    */
  --base-50:  #FAF8EC;   /* raised surface — light */
  --black:    #402625;   /* dark brown ink */
  --accent:   #205EA6;   /* blue-400 */
  /* Text and lines are one ink colour, differentiated by fixed opacity steps. */
  --ink:      64, 38, 37;   /* #402625 */
  --text-1:   rgba(var(--ink), 1);     /* primary  */
  --text-2:   rgba(var(--ink), .8);    /* body     */
  --text-3:   rgba(var(--ink), .55);   /* muted    */
  --text-4:   rgba(var(--ink), .38);   /* faint    */
  --base-150: rgba(var(--ink), .1);    /* subtle line */
  --base-200: rgba(var(--ink), .16);   /* line        */
  --text-sm:      .8125rem;
  --text-base:    1rem;
  --text-lg:      1.25rem;
  --text-2xl:     clamp(1.25rem, 6vw, 1.5rem);
  --text-display: clamp(2.25rem, 11vw, 3rem);
  --text-display-emoji: clamp(2.6rem, 12vw, 3rem);
}

* { box-sizing: border-box; }
a { color: inherit; text-decoration: underline; }
a:hover { color: var(--text-1); }
p { text-wrap: pretty; }

/* Kohandatud elemendid on ploki-tasandil. */
tana-card, aasta-tahtpaevad { display: block; }
/* Eelvaate (peek) paigutamiseks täpselt .today taha (nupurida jääb väljapoole). */
.today-stack { position: relative; }

/* Keelevahetus: näita ainult valitud keele silte. */
html:not([data-lang="en"]) [lang="en"] { display: none; }
html[data-lang="en"] [lang="et"] { display: none; }

/* ── "Täna" kaart ─────────────────────────────────────────────── */
.today { position: relative; margin: 0 0 clamp(.75rem, 3vw, 1.25rem); padding: clamp(1.25rem, 5vw, 1.5rem) clamp(1rem, 5vw, 1.5rem) 1.75rem; border: 1px solid rgba(var(--ink), .05); border-radius: 4px; background: var(--base-50); text-align: center; touch-action: pan-y; will-change: transform; }
/* Kaardivahetus: eelmine kaart (kloon) lendab minema, uus kerkib alt esile.
   Üleminekud seatakse JS-is inline (usaldusväärsem algväärtus); ligipääsetavuse
   eest hoolitseb JS-i reduceMotion-kontroll, mis animatsiooni üldse ei käivita. */
.today-ghost { position: fixed; margin: 0; z-index: 5; pointer-events: none; will-change: transform, opacity; }
/* Eelvaade: virna all näidatav järgmise/eelmise päeva sisu, täpselt .today
   asukohas (samas paigutuskontekstis, .today ees DOM-is) — nii jääb see
   alati päris kaardi TAHA, ka siis kui .hero-block (transform) tekitab oma
   pinu­konteksti, kus fikseeritud (fixed) positsioon oleks vale kihti sattunud.
   Nähtavale ilmub kohe, ilma üleminekuta; kadumisel (žesti katkestamisel) on
   kiire opacity-üleminek (JS-is inline). */
.today-peek { position: absolute; top: 0; left: 0; right: 0; margin: 0; pointer-events: none; opacity: 0; will-change: opacity; }
/* Nupurida jääb kaardist väljapoole (selle kohale, mitte sisse). */
.today-nav { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: 0 0 clamp(.75rem, 3vw, 1.25rem); }
.today-date { margin: 0 0 1.25rem; }
.today-date-label { display: block; font-family: "EB Garamond", Georgia, serif; font-size: clamp(1.375rem, 6.5vw, 1.6875rem); font-weight: 500; color: var(--text-1); line-height: 1.25; }
.today-date-rest { display: block; color: var(--text-3); font-size: var(--text-sm); margin-top: .2rem; }
.today-nav-btn {
  font: inherit;
  font-size: var(--text-lg);
  line-height: 1;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--base-200);
  border-radius: 999px;
  color: var(--text-1);
  cursor: pointer;
  transition-property: color, border-color, opacity, scale;
  transition-duration: .15s;
  transition-timing-function: ease-out;
}
.today-nav-btn:hover:not(:disabled) { border-color: var(--text-3); }
.today-nav-btn:active:not(:disabled) { scale: .96; }
.today-nav-btn:disabled { opacity: .35; cursor: default; }
.today-nav-dot {
  line-height: 1;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--base-200);
  border-radius: 999px;
  color: var(--text-3);
  cursor: pointer;
  transition-property: color, border-color, opacity, scale;
  transition-duration: .15s;
  transition-timing-function: ease-out;
}
/* Geomeetriline ring glüüfi asemel — täpselt keskel, ei sõltu fondi baasjoonest. */
.today-nav-dot span { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.today-nav-dot:hover:not(:disabled) { color: var(--text-1); border-color: var(--text-3); }
.today-nav-dot:active:not(:disabled) { scale: .96; }
.today-nav-dot:disabled { opacity: .35; cursor: default; }
.today-moon { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.today-emoji { font-size: var(--text-display-emoji); line-height: 1; }
.today-moon-name, .today-holiday-name {
  font-size: var(--text-base);
  font-weight: 500;
  line-height: 1.25;
  text-wrap: balance;
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: var(--text-3);
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
}
.today-moon-name:hover, .today-holiday-name:hover { text-decoration-color: var(--text-1); }
.today-moon-name:focus-visible, .today-holiday-name:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px;
}
.today-moon-desc { color: var(--text-2); font-size: var(--text-sm); margin: .7rem 0 0; }
.today-holiday { margin: 1.5rem 0 0; }
.today-holiday-item { display: flex; flex-direction: column; align-items: center; margin: 0 0 1rem; }
.today-holiday-item:last-child { margin-bottom: 0; }
.today-holiday-desc { color: var(--text-2); font-size: var(--text-sm); margin: .7rem 0 0; }

/* ── "Selle aasta tähtpäevad" ─────────────────────────────────── */
.year-list { margin: 0; padding: 0; list-style: none; }
.year-item { display: flex; gap: 1.1rem; padding: .85rem 0; }
.year-date { flex: 0 0 4.75rem; color: var(--text-3); font-size: var(--text-sm); padding-top: .15rem; text-transform: lowercase; }
.year-body { flex: 1; min-width: 0; }
.year-name { font-weight: 500; }
.year-desc { color: var(--text-3); font-size: var(--text-sm); margin: .2rem 0 0; }

/* ── Vallandaja-lingid ────────────────────────────────────────── */
.trigger { margin: 4rem 0 3rem; }
.trigger-link {
  appearance: none;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 500;
  text-wrap: balance;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: inherit;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
}
.trigger-link:hover { color: var(--text-1); }
.year-trigger { margin: 1.5rem 0 0; text-align: center; }
.year-trigger .trigger-link { font-size: var(--text-sm); font-weight: 500; color: var(--text-3); text-align: center; text-decoration-style: dotted; }
.year-trigger .trigger-link:hover { color: var(--text-1); }

/* ── Modaalid ─────────────────────────────────────────────────── */
dialog.modal[open] {
  border: none;
  border-radius: 16px;
  background: var(--base-50);
  color: var(--text-1);
  padding: 0;
  margin: auto;
  max-width: 560px;
  width: calc(100% - 2.5rem);
  max-height: min(82vh, 680px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
dialog.modal::backdrop {
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M6 6L18 18M18 6L6 18' stroke='%23FAF8EC' stroke-width='1.25' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, pointer;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  flex: 0 0 auto;
}
.modal-head h2 { margin: 0; font-family: "EB Garamond", Georgia, serif; font-size: clamp(1.5rem, 7vw, 1.875rem); font-weight: 400; text-wrap: balance; }
.modal-close {
  flex: 0 0 auto;
  font: inherit;
  font-size: var(--text-base);
  background: none;
  border: 1px solid var(--base-200);
  border-radius: 999px;
  color: var(--text-3);
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  transition-property: color, border-color;
  transition-duration: .15s;
}
.modal-close:hover { color: var(--text-1); border-color: var(--text-3); }
.modal-close:focus { outline: none; }
.modal-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.modal-body { padding: 0 1.5rem 1.5rem; overflow-y: auto; }
.modal-body--iframe { padding: 0 1.5rem 1.5rem; flex: 1 1 auto; }
.modal-body--iframe iframe { display: block; width: 100%; height: 100%; border: 0; }
#feedback-modal[open] { height: 94vh; max-height: 94vh; }

/* Bottom-sheet modal on phones */
@media (max-width: 480px) {
  dialog.modal[open] {
    width: 100%;
    max-width: none;
    max-height: 88vh;
    margin: auto auto 0;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    animation: sheet-up .22s ease;
  }
  .modal-body { padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  dialog.modal[open] { animation: none; }
}
