/* Recipe Wiki — ported from mockups/concept-1-spectral-forest.html (locked design). */

:root {
  --font-display: 'Spectral', Georgia, serif;
  --font-body: 'Spectral', Georgia, serif;
  --measure: 66ch;
}

/* ---------- LIGHT FOREST (default) ---------- */
html[data-mode="light"] {
  --bg: #f5f7f0;
  --paper: #fdfdf8;
  --ink: #1b2a1c;
  --ink-soft: #51604f;
  --line: #dbe3d4;
  --accent: #456b49;        /* muted forest — headings, links */
  --accent-soft: #e4ede0;
  --green: #1f8a4d;         /* saturated forest — the pop */
  --green-ink: #fff;        /* text on saturated green */
  --mark: #cfeec0;
  --danger: #a23b2e;
  --shadow: rgba(27, 42, 28, .06);
}

/* ---------- DARK FOREST ---------- */
html[data-mode="dark"] {
  --bg: #1e2a22;
  --paper: #26332a;
  --ink: #e9eee3;
  --ink-soft: #a4b6a1;
  --line: #384738;
  --accent: #8fc095;        /* lighter forest so it reads on dark */
  --accent-soft: #2c3a2f;
  --green: #3cc06e;         /* vivid forest — the pop */
  --green-ink: #0e150f;     /* dark text on bright green */
  --mark: #2f5a37;
  --danger: #e0897c;
  --shadow: rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 19px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; transition: background .25s, color .25s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
header.site { border-bottom: 1px solid var(--line); background: var(--bg); }
.bar {
  max-width: 1080px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; gap: 20px;
}
.logo {
  font-family: var(--font-display); font-weight: 800; font-size: 24px;
  letter-spacing: .2px; color: var(--ink); white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo .dot { color: var(--green); }
.search {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px; max-width: 520px; margin: 0 auto;
  box-shadow: 0 1px 2px var(--shadow);
}
.search input {
  border: 0; outline: 0; background: transparent; flex: 1;
  font-family: inherit; font-size: 16px; color: var(--ink);
}
.search input::placeholder { color: var(--ink-soft); opacity: .8; }
.search svg { flex: none; opacity: .5; }
.actions { display: flex; align-items: center; gap: 12px; }

/* primary button = saturated forest fill */
.btn {
  font-family: var(--font-body); font-size: 15px; font-weight: 600;
  border: 1px solid var(--green); color: var(--green-ink); background: var(--green);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
  display: inline-block; line-height: 1.2;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
/* secondary button = outline */
.btn.ghost { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn.ghost:hover { background: var(--accent); color: var(--paper); filter: none; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--paper); filter: none; }

/* ---- Dark-mode toggle ---- */
.toggle {
  display: inline-flex; align-items: center; cursor: pointer;
  background: transparent; border: 0; padding: 4px;
}
.toggle .track {
  width: 38px; height: 20px; border-radius: 999px; background: var(--green);
  position: relative; transition: .2s; display: inline-block;
}
.toggle .knob {
  position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
html[data-mode="dark"] .toggle .knob { left: 20px; }

main { max-width: 1080px; margin: 0 auto; padding: 48px 24px 96px; }
.empty { color: var(--ink-soft); font-style: italic; text-align: center; margin-top: 40px; }

/* ---- Home / list ---- */
.home-head { text-align: center; margin-bottom: 40px; }
.home-head h1 {
  font-family: var(--font-display); font-weight: 800; font-size: 54px;
  line-height: 1.05; margin: 0 0 8px; letter-spacing: -.01em;
}
.home-head .count { color: var(--ink-soft); font-style: italic; font-size: 18px; }
.section-label {
  font-family: var(--font-display); font-weight: 600; font-style: italic; font-size: 15px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--green);
  display: flex; align-items: center; gap: 14px; margin: 40px 0 8px;
  max-width: 760px; margin-inline: auto;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.reclist { list-style: none; margin: 0 auto; padding: 0; max-width: 760px; }
.reclist li { border-bottom: 1px solid var(--line); }
.reclist a.row {
  display: flex; align-items: baseline; gap: 16px; padding: 16px 6px 16px 14px; color: var(--ink);
  text-decoration: none; border-left: 3px solid transparent; transition: .12s;
}
.reclist a.row:hover {
  background: var(--accent-soft); text-decoration: none; border-radius: 0 8px 8px 0;
  border-left-color: var(--green);
}
.reclist .title { font-family: var(--font-display); font-weight: 700; font-size: 23px; }
.reclist .meta { margin-left: auto; color: var(--ink-soft); font-size: 14px; font-style: italic; white-space: nowrap; }

/* ---- Recipe view ---- */
article { max-width: var(--measure); margin: 0 auto; }
.crumb { font-size: 14px; color: var(--ink-soft); margin-bottom: 24px; }
article h1 {
  font-family: var(--font-display); font-weight: 800; font-size: 52px; line-height: 1.06;
  margin: 0 0 10px; letter-spacing: -.01em;
}
.byline {
  color: var(--ink-soft); font-style: italic; font-size: 16px;
  border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 8px;
}
.recipe-actions { display: flex; gap: 12px; margin: 20px 0 36px; }

.recipe-body h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 30px;
  margin: 44px 0 6px;
}
.recipe-body h3 {
  font-family: var(--font-body); font-weight: 600; font-style: italic; font-size: 21px;
  color: var(--accent); margin: 28px 0 4px;
}
.recipe-body p { margin: 12px 0; }
.recipe-body ul, .recipe-body ol { margin: 8px 0 14px; padding-left: 0; list-style: none; }
.recipe-body li { position: relative; padding: 1px 0 1px 28px; line-height: 1.45; }
.recipe-body ul li::before {
  content: ""; position: absolute; left: 6px; top: .62em; width: 7px; height: 7px;
  border-radius: 50%; background: var(--green);
}
.recipe-body ol { counter-reset: step; }
.recipe-body ol li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: .2em;
  font-size: 17px; font-weight: 600; color: var(--green);
}
.recipe-body blockquote {
  background: var(--accent-soft); border-left: 3px solid var(--green);
  padding: 14px 20px; border-radius: 0 8px 8px 0; margin: 18px 0; font-style: italic;
}
.recipe-body blockquote p { margin: 0; }
.recipe-body img { max-width: 100%; height: auto; border-radius: 8px; }
.recipe-body a { color: var(--accent); text-decoration: underline; }
.recipe-body code {
  background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em;
}
.recipe-body pre {
  background: var(--paper); border: 1px solid var(--line);
  padding: 14px 16px; border-radius: 8px; overflow: auto;
}
.recipe-body pre code { background: none; padding: 0; }
.recipe-body hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.recipe-body table { border-collapse: collapse; width: 100%; margin: 18px 0; }
.recipe-body th, .recipe-body td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }

/* ---- Search ---- */
.search-view { max-width: 760px; margin: 0 auto; }
.search-view h1 { font-family: var(--font-display); font-weight: 700; font-size: 34px; margin: 0 0 4px; }
.search-view .summary { color: var(--ink-soft); font-style: italic; margin-bottom: 28px; }
.result { display: block; padding: 20px 16px; margin: 0 -16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; border-radius: 6px; transition: background .12s ease; }
.result:hover { background: var(--accent-soft); text-decoration: none; }
.result:hover h3 { color: var(--accent); }
.result h3 { font-family: var(--font-display); font-weight: 700; font-size: 25px; margin: 0 0 4px; color: var(--ink); }
.result .excerpt { color: var(--ink-soft); font-size: 17px; line-height: 1.65; margin: 6px 0 0; }
.result .path { font-size: 13px; color: var(--ink-soft); opacity: .7; font-style: italic; margin-top: 6px; }
mark { background: var(--mark); color: var(--ink); padding: 0 2px; border-radius: 2px; }

/* ---- Editor ---- */
.editor { max-width: 860px; margin: 0 auto; }
.conflict-banner {
  max-width: 860px; margin: 0 auto 24px; padding: 14px 16px;
  border: 1px solid var(--danger); border-left-width: 3px; border-radius: 8px;
  background: var(--accent-soft); color: var(--ink); font-size: 15px; line-height: 1.5;
}
.conflict-banner strong { color: var(--danger); }
.title-input {
  width: 100%; font-family: var(--font-display); font-weight: 800; font-size: 38px;
  color: var(--ink); background: transparent; border: 0; border-bottom: 1px solid var(--line);
  padding: 4px 0 12px; margin-bottom: 20px; outline: 0; line-height: 1.1;
}
.title-input::placeholder { color: var(--ink-soft); opacity: .55; }
.editor-toolbar { display: flex; align-items: center; gap: 16px; min-height: 22px; margin-bottom: 10px; }
.save-state { margin-left: auto; font-size: 13px; font-style: italic; color: var(--ink-soft); }

/* Toast UI WYSIWYG editor — themed to the locked forest palette. Colors use the
   --vars so they track light/dark automatically; the dark toggle adds the editor's
   own .toastui-editor-dark class (see editor.js) for its icon/border set. */
.editor-mount { font-family: var(--font-body); }
/* Stack the UI as a column so the Markdown/WYSIWYG mode switch can be pulled to
   the top (order: -1) instead of sitting at the bottom of the editor. */
.toastui-editor-defaultUI {
  border: 1px solid var(--line); border-radius: 8px;
  display: flex; flex-direction: column;
}
.toastui-editor-defaultUI .toastui-editor-toolbar { background: var(--accent-soft); }
.toastui-editor-md-container, .toastui-editor-ww-container { background: var(--paper); }
.toastui-editor-contents { font-family: var(--font-body); font-size: 16px; color: var(--ink); }
/* Larger, more readable text while editing in WYSIWYG mode. */
.toastui-editor-ww-container .toastui-editor-contents { font-size: 19px; line-height: 1.65; }
.toastui-editor-contents h1, .toastui-editor-contents h2, .toastui-editor-contents h3 {
  font-family: var(--font-display); color: var(--accent); border-bottom: 0;
}
/* Markdown editing view: a larger monospace face for comfortable raw-Markdown
   editing. v3 renders this pane with ProseMirror (not CodeMirror). */
.toastui-editor-md-container .ProseMirror {
  color: var(--ink);
  font-family: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 17px;
  line-height: 1.7;
}
/* No preview in Markdown mode: hide the Write/Preview tab switcher so the
   markdown editor stays full-width (preview defaults to inactive). */
.toastui-editor-md-tab-container { display: none !important; }
.toastui-editor-mode-switch {
  order: -1; background: var(--paper); border-top: 0; border-bottom: 1px solid var(--line);
}
.toastui-editor-mode-switch .tab-item.active { color: var(--green); border-bottom-color: var(--green); }
.editor-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.editor-actions .spacer { flex: 1; }

@media (max-width: 680px) {
  body { font-size: 18px; }
  .bar { flex-wrap: wrap; }
  .search { order: 3; max-width: none; width: 100%; margin: 0; }
  .home-head h1 { font-size: 40px; }
  article h1, .title-input { font-size: 32px; }
}

/* ---- Login ---- */
main.login {
  max-width: 340px; margin: 12vh auto 0; padding: 0 24px;
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}
main.login .logo {
  font-family: var(--font-display); font-weight: 800; font-size: 34px;
  color: var(--ink);
}
main.login .logo .dot { color: var(--green); }
.login-form { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.login-form label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 15px; color: var(--ink-soft);
}
.login-form input {
  font-family: inherit; font-size: 18px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px;
}
.login-form input:focus { outline: none; border-color: var(--green); }
.login-form .btn { display: block; width: 100%; text-align: center; padding: 11px; font-size: 16px; }
.login-error {
  color: var(--danger); font-style: italic; margin: 0; text-align: center;
}
.logout { margin: 0; display: inline; }

/* ---- Print: first-class, not an afterthought ---- */
@page { margin: 1in; }

@media print {
  :root { --bg: #fff; --paper: #fff; --ink: #111; --ink-soft: #444; --line: #ccc; --accent: #111; --green: #111; }
  html, body { background: #fff; color: #000; font-size: 12pt; }
  header.site, .no-print, .crumb, .recipe-actions, .editor-toolbar, .editor-actions { display: none !important; }
  main { max-width: none; padding: 0; }
  article { max-width: none; }
  article h1 { font-size: 26pt; }
  .byline { border-bottom: 1px solid #ccc; }
  .recipe-body blockquote { background: none; border-left: 2px solid #999; }
  a { color: #000; text-decoration: none; }
  ul li::before { background: #000 !important; }
}
