/* ============================================================
   Glecipes theme — lightweight custom CSS (replaces Bootstrap)
   Retheme by editing the custom properties in :root below.
   ============================================================ */

/* ---- Fonts loaded in head.html via Google Fonts ---- */

/* ---------- Design tokens ---------- */
:root {
  --bg: #faf8f2;
  --surface: #ffffff;
  --surface-2: #f4f1e8;
  --border: #e7e3d7;
  --border-strong: #d8d3c4;
  --ink: #1f1e19;
  --muted: #6d6a5e;
  --faint: #9a978a;
  --accent: #556f2c;
  --accent-ink: #3f5320;
  --accent-soft: #eaefdc;
  --accent-line: #c8d4a3;
  --shadow: 0 1px 2px rgba(31,30,25,.04), 0 8px 24px rgba(31,30,25,.06);
  --shadow-lg: 0 4px 12px rgba(31,30,25,.08), 0 24px 48px rgba(31,30,25,.10);

  /* Fallback-tile colors, driven by per-recipe --cat-h (category hue) */
  --tile-bg:    hsl(var(--cat-h, 78) 40% 92%);
  --tile-wm:    hsl(var(--cat-h, 78) 45% 34%);
  --tile-wm-op: .14;
  --tile-title: hsl(var(--cat-h, 78) 48% 22%);
  --tile-glyph: hsl(var(--cat-h, 78) 45% 34%);
  --tile-cat:   hsl(var(--cat-h, 78) 42% 32%);

  --sans: 'Hanken Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Space Grotesk', var(--sans);
  --wrap: 1160px;
}

/* Dark theme — explicit toggle */
:root[data-theme="dark"] {
  --bg: #17160f;
  --surface: #201e16;
  --surface-2: #272419;
  --border: #34301f;
  --border-strong: #423d29;
  --ink: #f2efe4;
  --muted: #a8a394;
  --faint: #75715f;
  --accent: #a6c368;
  --accent-ink: #c3d98f;
  --accent-soft: #2a2c1a;
  --accent-line: #4a5330;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.4), 0 24px 48px rgba(0,0,0,.45);
  --tile-bg:    hsl(var(--cat-h, 78) 22% 16%);
  --tile-wm:    hsl(var(--cat-h, 78) 42% 62%);
  --tile-wm-op: .16;
  --tile-title: hsl(var(--cat-h, 78) 40% 82%);
  --tile-glyph: hsl(var(--cat-h, 78) 40% 60%);
  --tile-cat:   hsl(var(--cat-h, 78) 35% 62%);
}

/* Dark theme — follow OS when user hasn't chosen explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17160f; --surface: #201e16; --surface-2: #272419;
    --border: #34301f; --border-strong: #423d29;
    --ink: #f2efe4; --muted: #a8a394; --faint: #75715f;
    --accent: #a6c368; --accent-ink: #c3d98f; --accent-soft: #2a2c1a; --accent-line: #4a5330;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 4px 12px rgba(0,0,0,.4), 0 24px 48px rgba(0,0,0,.45);
    --tile-bg: hsl(var(--cat-h,78) 22% 16%); --tile-wm: hsl(var(--cat-h,78) 42% 62%); --tile-wm-op:.16;
    --tile-title: hsl(var(--cat-h,78) 40% 82%); --tile-glyph: hsl(var(--cat-h,78) 40% 60%); --tile-cat: hsl(var(--cat-h,78) 35% 62%);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.06; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }

/* ---------- Buttons ---------- */
.btn { font-family: var(--sans); font-size: 15px; font-weight: 600; border-radius: 11px; padding: 13px 22px; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 8px; transition: transform .12s, background .15s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.brand { display: inline-flex; align-items: baseline; gap: 4px; color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 23px; }
.brand__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); align-self: center; }
.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav a { padding: 8px 13px; border-radius: 9px; font-size: 14.5px; font-weight: 500; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.header-spacer { flex: 1; }
.search { display: flex; }
.search .input-group { display: flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 4px 6px 4px 14px; }
.search input { background: transparent; border: none; outline: none; font-family: var(--sans); font-size: 14px; color: var(--ink); width: 150px; }
.search button { background: var(--accent); color: #fff; border: none; border-radius: 999px; padding: 7px 14px; font-family: var(--sans); font-size: 13px; font-weight: 600; cursor: pointer; }
.theme-toggle { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); cursor: pointer; font-size: 16px; }
.theme-toggle .icon-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-light { display: none; }

.nav-toggle { display: none; }

/* ---------- Home ---------- */
main { animation: gl-fade .3s ease; }
@keyframes gl-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 34px; align-items: center; padding: 30px 0 12px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); padding: 6px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600; margin-bottom: 20px; }
.hero h1 { font-size: clamp(38px, 5vw, 58px); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 18px; }
.hero p { font-size: 18px; color: var(--muted); max-width: 44ch; margin: 0 0 26px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero__feature { border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 48px 0 18px; }
.section-head h2 { font-size: 24px; margin: 0; }

/* ---------- Card grid ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; }
.card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; overflow: hidden; box-shadow: var(--shadow); color: var(--ink); transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--ink); }
.card__body { padding: 13px 15px 15px; }
.card__title { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; line-height: 1.15; margin: 0 0 9px; }
.card__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 9px; }
.pill { font-size: 11px; font-weight: 600; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 9px; border-radius: 999px; }
.card__meta { font-size: 12.5px; color: var(--muted); font-family: var(--display); }

/* ---------- Fallback tile ---------- */
.rc-tile { position: relative; aspect-ratio: 16/10; display: flex; overflow: hidden; background: var(--tile-bg); }
.rc-tile--hero { aspect-ratio: 24/7; border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.rc-tile__wm { position: absolute; left: -6px; bottom: -26px; font-family: var(--display); font-weight: 700; font-size: 120px; line-height: .8; color: var(--tile-wm); opacity: var(--tile-wm-op); letter-spacing: -.04em; pointer-events: none; user-select: none; }
.rc-tile--hero .rc-tile__wm { font-size: 200px; bottom: -42px; }
.rc-tile__side { position: absolute; right: 11px; top: 11px; bottom: 11px; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.rc-tile--hero .rc-tile__side { right: 18px; top: 18px; bottom: 18px; gap: 10px; }
.rc-tile__cat { writing-mode: vertical-rl; font-size: 10px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--tile-cat); opacity: .82; }
.rc-tile--hero .rc-tile__cat { font-size: 12px; }
.rc-tile__title { position: relative; margin-top: auto; padding: 13px 42px 13px 14px; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; color: var(--tile-title); line-height: 1.02; }
.rc-tile__badge { position: absolute; top: 14px; left: 14px; font-family: var(--display); font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 4px 10px; border-radius: 7px; }
/* Glyphs */
.rc-tile__glyph { flex: none; }
.rc-tile__glyph--circle { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--tile-glyph); opacity: .8; }
.rc-tile__glyph--diamond { width: 22px; height: 22px; background: var(--tile-glyph); opacity: .82; transform: rotate(45deg); border-radius: 4px; }
.rc-tile__glyph--triangle { width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent; border-bottom: 22px solid var(--tile-glyph); opacity: .82; }
.rc-tile__glyph--square { width: 22px; height: 22px; background: var(--tile-glyph); opacity: .82; border-radius: 5px; }
.rc-tile--hero .rc-tile__glyph--circle { width: 32px; height: 32px; }
/* Real photo variant */
.rc-photo { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.rc-photo--hero { aspect-ratio: 24/7; border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }

/* ---------- Tag chips / filters ---------- */
.taglist { display: flex; gap: 10px; flex-wrap: wrap; }
.tagbtn { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 11px; padding: 11px 17px; font-family: var(--sans); font-size: 14.5px; font-weight: 600; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.tagbtn sup, .tagbtn .count { font-size: 11.5px; color: var(--faint); font-weight: 500; }
.filterbar { display: flex; gap: 9px; flex-wrap: wrap; margin: 4px 0 26px; }
.filter { font-family: var(--sans); font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 999px; cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); }
.filter.is-active { border-color: var(--accent); background: var(--accent); color: #fff; }

.page-title { font-size: clamp(30px, 4vw, 42px); letter-spacing: -.03em; margin: 30px 0 6px; }
.page-sub { color: var(--muted); font-size: 16px; margin: 0 0 24px; }

/* ---------- Recipe detail ---------- */
.recipe { padding: 22px 0 70px; }
.backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; font-weight: 600; margin-bottom: 18px; }
.recipe__head { max-width: 760px; }
.recipe__tags { display: flex; gap: 7px; flex-wrap: wrap; margin: 26px 0 14px; }
.recipe__tags .pill { border: 1px solid var(--accent-line); padding: 4px 11px; font-size: 12px; }
.recipe__title { font-size: clamp(36px, 5vw, 54px); letter-spacing: -.03em; line-height: 1.02; margin: 0 0 14px; }
.recipe__desc { font-size: 18px; color: var(--muted); margin: 0 0 16px; }
.recipe__author { font-size: 14.5px; color: var(--muted); margin: 0 0 26px; }
.recipe__author a { border-bottom: 1px solid var(--accent-line); font-weight: 600; }

.meta { display: flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 26px; background: var(--surface); max-width: 760px; }
.meta__cell { flex: 1; min-width: 110px; padding: 16px 18px; border-right: 1px solid var(--border); }
.meta__cell:last-child { border-right: none; }
.meta__label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.meta__value { font-family: var(--display); font-size: 19px; font-weight: 600; }

.recipe__actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 34px; }

/* Wake-lock / cooking bar */
.cookbar { display: none; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 13px; padding: 14px 18px; margin-bottom: 28px; }
.cooking-on .cookbar { display: flex; }
.cookbar__title { font-weight: 700; font-size: 15px; color: var(--accent-ink); }
.cookbar__sub { font-size: 13px; color: var(--muted); }
.cookbar label { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; font-weight: 600; }
.cookbar input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

/* Body grid */
.recipe__body { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 44px; align-items: start; }
.cooking-on .recipe__body { grid-template-columns: 1fr; max-width: 820px; gap: 34px; }
.ingredients { position: sticky; top: 84px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; }
.cooking-on .ingredients { position: static; }
.ingredients h2, .steps h2 { font-size: 22px; margin: 0 0 14px; }

/* Scaler */
.scaler { margin-bottom: 20px; }
.scaler__label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.scaler__group { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 4px; gap: 2px; }
.scaler__btn { font-family: var(--display); font-size: 14px; font-weight: 700; padding: 8px 15px; border-radius: 8px; border: none; cursor: pointer; background: transparent; color: var(--muted); }
.scaler__btn.is-active { background: var(--accent); color: #fff; }

/* Ingredient list */
.ing-group { margin-bottom: 18px; }
.ing-group__name { font-size: 13px; font-weight: 700; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 9px; }
.ing-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ing { display: flex; align-items: flex-start; gap: 11px; padding: 8px; border-radius: 9px; cursor: pointer; }
.cooking-on .ing { padding: 11px 8px; }
.ing__box { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); background: transparent; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; transition: all .12s; }
.cooking-on .ing__box { width: 22px; height: 22px; }
.ing__text { font-size: 15px; line-height: 1.4; }
.cooking-on .ing__text { font-size: 17px; }
.ing__qty { color: var(--accent-ink); font-weight: 700; font-family: var(--display); }
.ing.is-checked .ing__box { border-color: var(--accent); background: var(--accent); }
.ing.is-checked .ing__text { color: var(--faint); text-decoration: line-through; }
.ing.is-checked .ing__qty { color: var(--faint); }

/* Steps */
.steps { min-width: 0; }
.steplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.cooking-on .steplist { gap: 16px; }
.step { display: flex; gap: 15px; padding: 15px 17px; border-radius: 14px; cursor: pointer; border: 1px solid var(--border); background: var(--surface); transition: all .15s; }
.cooking-on .step { gap: 18px; padding: 20px 22px; box-shadow: var(--shadow); }
.step__num { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 15px; }
.cooking-on .step__num { width: 38px; height: 38px; font-size: 17px; }
.step__name { font-family: var(--display); font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; margin-bottom: 4px; }
.cooking-on .step__name { font-size: 18px; }
.step__text { font-size: 15.5px; line-height: 1.55; color: var(--muted); }
.cooking-on .step__text { font-size: 18px; }
.step.is-checked { background: var(--surface-2); opacity: .6; }
.cooking-on .step.is-checked { box-shadow: none; }
.step.is-checked .step__num { background: var(--faint); }
.step.is-checked .step__name { text-decoration: line-through; }

.protips { margin-top: 26px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.protips h3 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.protips ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.protips li { font-size: 15px; line-height: 1.5; color: var(--muted); }

.voice-note { margin-top: 26px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--faint); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 11px; padding: 12px 15px; }
.voice-note b { font-family: var(--display); color: var(--accent-ink); }

/* ---------- Search results (rendered by search-lunar.js) ---------- */
.main-inner { max-width: 720px; margin: 20px auto 60px; padding: 0 20px; }
.list-title { font-family: var(--display); font-size: clamp(26px, 3.5vw, 36px); letter-spacing: -.02em; margin: 0 0 20px; }
.content.post { padding: 16px; border-radius: 13px; border: 1px solid transparent; }
.content.post:hover { background: var(--surface); border-color: var(--border); }
.post-title { font-family: var(--display); font-size: 19px; font-weight: 600; margin: 0 0 3px; }
.summary { display: block; font-size: 14px; color: var(--muted); line-height: 1.4; }
.read-more-container { margin-top: 6px; }
.read-more-link { font-size: 13px; font-weight: 600; }

/* ---------- Article / About ---------- */
.article { max-width: 640px; padding: 40px 0 60px; }
.article h1 { font-size: clamp(30px, 4vw, 44px); letter-spacing: -.03em; margin: 0 0 20px; }
.article p { font-size: 17px; line-height: 1.65; color: var(--ink); margin: 0 0 18px; }
/* Originals folder tree (directoryindex shortcode) */
.dirtree { list-style: none; margin: 0 0 18px; padding: 0; }
.dirtree .dirtree { margin: 4px 0 6px 14px; padding-left: 12px; border-left: 1px solid var(--border); }
.dirtree li { margin: 0; }
.dirtree__file a { display: block; padding: 5px 0; font-size: 15px; }
.dirtree__dir summary { cursor: pointer; padding: 6px 0; font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink); }
.dirtree__dir summary::marker { color: var(--accent); }
.article__mark { width: 74px; height: 74px; border-radius: 20px; background: var(--accent-soft); border: 1px solid var(--accent-line); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--accent-ink); margin-bottom: 24px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); }
.site-footer .wrap { padding: 30px 20px 44px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 13.5px; }

/* ---------- Responsive (mobile-first refinements) ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero__feature { order: -1; }
  .recipe__body { grid-template-columns: 1fr; gap: 28px; }
  .ingredients { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-header .wrap { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .search input { width: 110px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .rc-tile--hero { aspect-ratio: 16/9; }
  .rc-tile--hero .rc-tile__wm { font-size: 140px; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .recipe__actions, .cookbar, .scaler, .theme-toggle, .backlink, .voice-note, .search { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .recipe__body { display: block; }
  .ingredients { position: static; border: none; padding: 0; page-break-inside: avoid; }
  .steps { margin-top: 20pt; }
  .step { break-inside: avoid; border: none; padding: 6pt 0; }
  .rc-tile, .rc-photo { display: none; }
  a { color: #000; text-decoration: underline; }
}
