/* ============================================================
   Havineini - Sage editorial theme layer (option 4)
   Loads LAST, after dark.css. Presentation only: no behavior.
   Tokens measured from the approved option-4 mockups.
   Hebrew content stays in Noto Sans Hebrew (readable sans);
   DM Serif Display is used for English display headings only.
   Feed accent colors are contextual (viewed-feed rule) and are
   NOT overridden here - the app owns those.
   ============================================================ */

:root {
  --sage-paper: #EDECE6;      /* page background, warm paper */
  --sage-surface: #FFFEF9;    /* cards / header / nav */
  --sage-ink: #282C28;        /* primary text */
  --sage-ink-2: #57604F;      /* secondary text */
  --sage-ink-3: #8B9284;      /* tertiary text */
  --sage-accent: #587C30;     /* sage green accents */
  --sage-accent-deep: #4C683C;
  --sage-rule: rgba(40, 44, 40, 0.14);   /* hairlines */
  --sage-rule-soft: rgba(40, 44, 40, 0.08);
  --sage-serif: "DM Serif Display", Georgia, serif;
  --sage-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
}

/* ---------- page background ---------- */
html:not(.dark), html:not(.dark) body { background: var(--sage-paper) !important; }
/* the app's own paper utility + inline paper backgrounds */
html:not(.dark) .bg-\[\#F7F5F0\], html:not(.dark) .bg-\[\#F7F5F0\]\/95 { background-color: var(--sage-paper) !important; }
html:not(.dark) [style*="background: rgb(247, 245, 240)"],
html:not(.dark) [style*="background-color: rgb(247, 245, 240)"],
html:not(.dark) [style*="background:#F7F5F0"],
html:not(.dark) [style*="background: #F7F5F0"] { background: var(--sage-paper) !important; }
html:not(.dark) [style*="background: rgb(255, 255, 255)"],
html:not(.dark) [style*="background-color: rgb(255, 255, 255)"],
html:not(.dark) [style*="background: rgb(255, 254, 250)"],
html:not(.dark) [style*="background:#fff"],
html:not(.dark) [style*="background: #fff"],
html:not(.dark) [style*="background:#FFFEFA"],
html:not(.dark) [style*="background: #FFFEFA"] { background: var(--sage-surface) !important; }

/* ink / muted text re-color (inline-style values used by the app) */
html:not(.dark) [style*="color: rgb(26, 26, 26)"],
html:not(.dark) [style*="color:#1A1A1A"],
html:not(.dark) [style*="color: #1A1A1A"] { color: var(--sage-ink) !important; }
html:not(.dark) [style*="color: rgb(90, 80, 64)"],
html:not(.dark) [style*="color:#5A5040"],
html:not(.dark) [style*="color: #5A5040"] { color: var(--sage-ink-2) !important; }
html:not(.dark) [style*="color: rgb(138, 126, 110)"],
html:not(.dark) [style*="color:#8A7E6E"],
html:not(.dark) [style*="color: #8A7E6E"] { color: var(--sage-ink-3) !important; }

/* teal brand accent -> sage accent (inline-style occurrences) */
html:not(.dark) [style*="color: rgb(31, 107, 107)"],
html:not(.dark) [style*="color:#1F6B6B"],
html:not(.dark) [style*="color: #1F6B6B"] { color: var(--sage-accent) !important; }
html:not(.dark) [style*="background: rgb(31, 107, 107)"],
html:not(.dark) [style*="background-color: rgb(31, 107, 107)"],
html:not(.dark) [style*="background:#1F6B6B"],
html:not(.dark) [style*="background: #1F6B6B"] { background: var(--sage-accent) !important; }

/* ---------- header ---------- */
header.grid {
  background: var(--sage-surface) !important;
  border-bottom: 1px solid var(--sage-rule);
  box-shadow: none !important;
}
/* Donate button: calm sage outline */
header button[class*="justify-self-start"] {
  color: var(--sage-accent-deep) !important;
}

/* ---------- Today date block: editorial hero ---------- */
.x69-day, .x31-day { position: relative; }
.x69-day::before {
  content: "HAVINEINI";
  display: block;
  font-family: var(--sage-sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--sage-accent);
  margin-bottom: 4px;
}
html body .x69-day .x69-d1, html body main h1.text-\[20px\] {
  font-family: var(--sage-serif) !important;
  font-weight: 400 !important;
  font-size: 34px !important;
  line-height: 1.05 !important;
  letter-spacing: 0 !important;
  color: var(--sage-ink) !important;
}
.x69-d2 { color: var(--sage-ink-2) !important; }
.x69-d3 { color: var(--sage-ink-3) !important; }
.x13-line { color: var(--sage-ink-2) !important; }

/* My Feed note bar: quiet sage strip, no heavy fill */
.hv-mfb {
  background: rgba(88, 124, 48, 0.08) !important;
  border: 1px solid rgba(88, 124, 48, 0.22) !important;
  color: var(--sage-accent-deep) !important;
  border-radius: 10px !important;
}

/* ---------- shiur rows: book-list, fine rules (no heavy cards) ---------- */
.x51 {
  background: transparent !important;
  border: none !important;
  border-bottom: 1px solid var(--sage-rule-soft) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin-bottom: 0 !important;
  padding-top: 4px !important;
}
/* row containers that added card spacing tighten into a list */
.grid.grid-cols-1.md\:grid-cols-2.gap-2 { gap: 0 12px !important; }
.x76-t { color: var(--sage-ink) !important; }
.x27-date, .x50-dur, .x123-d { color: var(--sage-ink-3) !important; }

/* play circle: quiet gray-sage disc; the triangle keeps the
   contextual feed color the app assigns (no override on icon) */
.x15-play {
  background: #E9EAE2 !important;
  box-shadow: none !important;
}

/* ---------- section headings: serif editorial ---------- */
html body main h2.text-\[16px\], .hv-sub {
  font-family: var(--sage-serif) !important;
  font-weight: 400 !important;
  font-size: 22px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--sage-ink) !important;
}
/* section auxiliary links ("Archive ->", "Browse all") */
button.text-\[12px\] {
  color: var(--sage-accent-deep) !important;
}

/* hairline dividers */
.h-px { background: var(--sage-rule) !important; }

/* ---------- kuntres mini cards ---------- */
button.rounded-xl.p-2 {
  background: var(--sage-surface) !important;
  border: 1px solid var(--sage-rule-soft) !important;
  box-shadow: none !important;
}

/* ---------- feed tiles: white card + feed-colored top rule ---------- */
/* app.js exposes --tile-accent per tile; fallback to sage for safety */
.hv-feed-tile, .hv-feed-tile-english, .hv-feedgrid > button {
  background: var(--sage-surface) !important;
  border: 1px solid var(--sage-rule-soft) !important;
  border-top: 3px solid var(--tile-accent, var(--sage-accent)) !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}
.hv-feed-tile-name { font-family: "Noto Sans Hebrew", sans-serif !important; }

/* Browse All / My Feed list rows: paper rows with hairlines */
.hv-shiurim-pad > a, .hv-shiurim-pad > button[class], main .hv-listrow {
  border-radius: 10px !important;
}

/* ---------- bottom nav: paper bar, hairline, sage active ---------- */
.md\:hidden.flex-shrink-0.px-3.pt-2,
nav, [class*="bottom-nav"], .hv-bnav {
  background: var(--sage-surface) !important;
  border-top: 1px solid var(--sage-rule) !important;
  box-shadow: none !important;
}

/* bottom nav active item -> sage */
[class*="px-3"][class*="py-1"][aria-current="page"],
nav [aria-current="page"] { color: var(--sage-accent-deep) !important; }

/* ---------- buttons/switches accent (hv components) ---------- */
.hv-sbtn { background: var(--sage-accent) !important; }
.hv-sbtn.ghost { background: rgba(88, 124, 48, 0.08) !important; color: var(--sage-accent) !important; }
.hv-speeds button { background: #E6E8DD !important; }
.hv-speeds button.on { background: var(--sage-accent) !important; }
.hv-sw2.on { background: var(--sage-accent) !important; }

/* ---------- dark mode untouched in this slice: dark.css owns it ---------- */

/* ---------- sage dark mode (palette replaces the old navy dark) ---------- */
/* donate page is inline-styled brand navy; retheme to sage */
[style*="linear-gradient(180deg, rgb(30, 86, 176)"]{background:linear-gradient(180deg,#4C683C 0%,#3E5832 100%) !important}
[style*="background: rgb(30, 86, 176)"]{background:#587C30 !important}
[style*="color: rgb(30, 86, 176)"]{color:#587C30 !important}

html.dark { --sage-paper: #232820; --sage-surface: #2C3227; --sage-ink: #E9EBDF;
  --sage-ink-2: #B5BCA9; --sage-ink-3: #8A917E; --sage-accent: #9DB87A;
  --sage-accent-deep: #B7CFA0; --sage-rule: rgba(233,235,223,.16); --sage-rule-soft: rgba(233,235,223,.09);
  background: #232820 !important; color-scheme: dark; }
html.dark body #x9-tab{background:#2C3227 !important}
html.dark body { background: #232820 !important; color: #E9EBDF !important; }

/* inline-value remapping in dark mode is owned by dark.css
   (its palette values were replaced with the sage-dark set) */

html.dark .x51 { background: transparent !important; border-bottom-color: rgba(233,235,223,.09) !important; }
html.dark header.grid, html.dark .md\:hidden.flex-shrink-0.px-3.pt-2 { background: #2C3227 !important; }
html.dark .hv-feed-tile, html.dark .hv-feed-tile-english, html.dark .hv-feedgrid > button { background: #2C3227 !important; }
html.dark .x15-play { background: #3A4132 !important; }
html.dark .hv-mfb { background: rgba(157,184,122,.10) !important; border-color: rgba(157,184,122,.3) !important; color: #B7CFA0 !important; }
html.dark button.rounded-xl.p-2 { background: #2C3227 !important; border-color: rgba(233,235,223,.09) !important; }
html.dark .x76-t { color: #E9EBDF !important; }
html.dark .x27-date, html.dark .x50-dur, html.dark .x123-d { color: #8A917E !important; }
html.dark .hv-sbtn { background: #9DB87A !important; color: #232820 !important; }
html.dark .hv-sw2.on { background: #9DB87A !important; }
