/* what.sarl */
:root {
  --paper: #f7f4ec;
  --paper-2: #efeadd;
  --card: #fffdf8;
  --ink: #1c1a16;
  --ink-2: #57524a;
  --ink-3: #8b8478;
  --rule: #ddd6c6;
  --accent: #c2410c;
  --accent-ink: #fff;
  --accent-soft: #f6dccd;
  --ok: #3f7d4e;
  --danger: #b42318;
  --code-bg: #ece6d8;
  --shadow: 0 1px 2px rgb(40 30 10 / .06), 0 8px 24px rgb(40 30 10 / .06);

  --display: "Fraunces", Georgia, serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --measure: 40rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14130f;
    --paper-2: #1c1a15;
    --card: #1e1c17;
    --ink: #ece6d8;
    --ink-2: #b4ac9c;
    --ink-3: #807868;
    --rule: #333027;
    --accent: #f08a4b;
    --accent-ink: #1a0f08;
    --accent-soft: #3a2416;
    --ok: #7cc08d;
    --danger: #f07065;
    --code-bg: #24211b;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.15rem/1.65 var(--serif);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 1rem 4rem; }
a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: .08em; text-underline-offset: .18em; }
a:hover { color: var(--accent); }
::selection { background: var(--accent-soft); }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ chrome */
.site-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  max-width: var(--measure); width: 100%; margin: 0 auto; padding: 1.4rem 1rem;
  font-family: var(--sans); font-size: .92rem;
}
.brand { font: 700 1.15rem/1 var(--display); text-decoration: none; letter-spacing: -.01em; }
.brand-q { color: var(--accent); margin-left: 1px; }
.site-head nav { display: flex; align-items: center; gap: 1.1rem; }
.site-head nav a:not(.btn) { text-decoration: none; color: var(--ink-2); }
.site-head nav a:not(.btn):hover { color: var(--ink); }
form.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; }
.linkish:hover { color: var(--accent); }

.site-foot {
  max-width: var(--measure); width: 100%; margin: 0 auto; padding: 2rem 1rem 2.5rem;
  display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap;
  font: .82rem var(--sans); color: var(--ink-3); border-top: 1px solid var(--rule);
}
.site-foot a { text-decoration: none; color: var(--ink-3); }

.flash, .notice {
  max-width: var(--measure); margin: 0 auto 1rem; padding: .6rem 1rem;
  font: .9rem var(--sans); background: var(--accent-soft); border-radius: 8px;
}
.flash { width: calc(100% - 2rem); }

/* ----------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: 600 .9rem/1 var(--sans); padding: .65rem 1rem; border-radius: 999px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .08s ease, background .15s ease;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn-small { padding: .45rem .8rem; font-size: .82rem; }
.btn-wide { width: 100%; padding: .85rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-3); }
.btn-danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------- headings */
.display { font-family: var(--display); font-weight: 800; letter-spacing: -.025em; line-height: 1.05; font-variation-settings: "opsz" 144; }
.intro { padding: 3rem 0 2rem; }
.intro .display { font-size: clamp(2.6rem, 9vw, 4.2rem); margin: 0; }
.tagline { margin: .4rem 0 0; color: var(--ink-2); font-style: italic; font-size: 1.2rem; }
.section-label { font: 600 .75rem var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); margin: 0 0 .8rem; }

/* -------------------------------------------------------------- feed */
.feed { list-style: none; padding: 0; margin: 0; }
.feed-item { padding: 1.8rem 0; border-top: 1px solid var(--rule); }
.feed-item time { font: 500 .78rem var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.feed-item h2 { font: 700 1.6rem/1.15 var(--display); letter-spacing: -.015em; margin: .35rem 0 .5rem; }
.feed-item h2 a { text-decoration: none; }
.feed-item.lead h2 { font-size: clamp(2rem, 6vw, 2.6rem); }
.feed-item p { margin: 0 0 .6rem; color: var(--ink-2); }
.more { font: 600 .82rem var(--sans); text-decoration: none; color: var(--accent); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 0; font: .9rem var(--sans); border-top: 1px solid var(--rule); }
.empty { text-align: center; padding: 4rem 0; color: var(--ink-2); }
.empty .display { font-size: 4rem; margin: 0; color: var(--ink); }

/* -------------------------------------------------------------- post */
.post header { padding: 2.5rem 0 1.5rem; }
.post header time { font: 500 .8rem var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.post h1.display { font-size: clamp(2.2rem, 7vw, 3.4rem); margin: .4rem 0 .8rem; overflow-wrap: anywhere; }
.post .meta { font: .88rem var(--sans); color: var(--ink-3); margin: 0; }
.post .notice { margin: 1.5rem 0 0; }

.prose { font-size: 1.2rem; line-height: 1.7; overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure { margin: 0 0 1.3em; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { font-family: var(--display); letter-spacing: -.015em; line-height: 1.2; margin: 2em 0 .6em; }
.prose h1, .prose h2 { font-size: 1.65rem; }
.prose h3 { font-size: 1.3rem; }
.prose h4, .prose h5, .prose h6 { font-size: 1.1rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--accent); }
.prose li.task { list-style: none; margin-left: -1.4em; }
.prose blockquote { border-left: 3px solid var(--accent); padding: .1em 0 .1em 1.1em; color: var(--ink-2); font-style: italic; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font: .85em var(--mono); background: var(--code-bg); padding: .12em .35em; border-radius: 4px; }
.prose pre { background: var(--code-bg); padding: 1rem 1.1rem; border-radius: 10px; overflow-x: auto; line-height: 1.5; }
.prose pre code { background: none; padding: 0; font-size: .82rem; }
.prose hr { border: 0; text-align: center; margin: 2.5em 0; }
.prose hr::after { content: "· · ·"; color: var(--ink-3); letter-spacing: .5em; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; }
.prose figure img { margin: 0 auto; }
.prose figcaption { font: .85rem var(--sans); color: var(--ink-3); text-align: center; margin-top: .6rem; }
.prose a { color: var(--accent); }
.prose del { color: var(--ink-3); }

.neighbours { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.neighbours a { text-decoration: none; font: 600 1.05rem/1.3 var(--display); }
.neighbours small { display: block; font: 500 .72rem var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: .3rem; }
.neighbours .next { text-align: right; grid-column: 2; }

/* ----------------------------------------------------------- archive */
.archive-tools { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1.5rem; position: sticky; top: 0; background: var(--paper); padding: .7rem 0; z-index: 2; }
.archive-tools input { flex: 1 1 14rem; }
.years { display: flex; gap: .3rem; flex-wrap: wrap; font: .85rem var(--sans); }
.years a { text-decoration: none; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--rule); color: var(--ink-2); }
.years a:hover { border-color: var(--accent); color: var(--accent); }

.timeline { position: relative; }
.tl-year { position: relative; padding-left: 1.6rem; border-left: 2px solid var(--rule); margin-left: .4rem; padding-bottom: 1.5rem; scroll-margin-top: 5rem; }
.tl-year-label { font: 800 2.2rem/1 var(--display); letter-spacing: -.03em; margin: 0 0 1rem; position: relative; }
.tl-year-label::before {
  content: ""; position: absolute; left: calc(-1.6rem - 8px); top: .5rem; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--paper);
}
.tl-month { margin-bottom: 1.4rem; }
.tl-month-label { font: 600 .75rem var(--sans); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-3); margin: 0 0 .5rem; position: relative; }
.tl-month-label::before {
  content: ""; position: absolute; left: calc(-1.6rem - 4px); top: .35em; width: 6px; height: 6px;
  border-radius: 50%; background: var(--ink-3);
}
.tl-month-label span { font-weight: 400; margin-left: .3rem; }
.tl-month ol { list-style: none; margin: 0; padding: 0; }
.tl-item { display: grid; grid-template-columns: 2.6rem 1fr; gap: .6rem; padding: .55rem 0; align-items: baseline; }
.tl-item time { font: 600 1rem var(--mono); color: var(--ink-3); text-align: right; }
.tl-item time sup { font-size: .55em; margin-left: 1px; }
.tl-item a { font: 600 1.15rem/1.3 var(--display); text-decoration: none; letter-spacing: -.01em; }
.tl-item p { margin: .2rem 0 0; font-size: .98rem; color: var(--ink-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.drafts { background: var(--card); border: 1px dashed var(--rule); border-radius: 12px; padding: 1rem 1.2rem; margin-bottom: 2rem; }
.drafts ul { list-style: none; margin: 0; padding: 0; }
.drafts li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .35rem 0; }
.drafts li a { font: 600 1.05rem var(--display); text-decoration: none; }
.badge { font: 600 .68rem var(--sans); text-transform: uppercase; letter-spacing: .08em; padding: .15rem .45rem; border-radius: 4px; background: var(--paper-2); color: var(--ink-2); }
.badge-sched { background: var(--accent-soft); color: var(--accent); }

/* ------------------------------------------------------------- forms */
input, textarea, select {
  font: 1rem var(--sans); color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: 8px; padding: .65rem .8rem; width: 100%;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
label { display: block; font: 600 .85rem var(--sans); color: var(--ink-2); }
label > input, label > textarea, label > .slug-wrap { margin-top: .35rem; }
.stack > * + * { margin-top: 1rem; }
.hint { display: block; font-weight: 400; font-size: .78rem; color: var(--ink-3); margin-top: .3rem; }

.page-auth main { display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 24rem; margin: 3rem auto; background: var(--card); padding: 2rem; border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--rule); }
.auth-card .display { font-size: 2.4rem; margin: 0 0 .5rem; }
.auth-card .muted { font-size: 1rem; margin-top: 0; }
.error { color: var(--danger); font: .9rem var(--sans); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: .6rem .8rem; border-radius: 8px; }

/* ------------------------------------------------------------ editor */
.page-editor main { max-width: none; padding: 0; }
.page-editor .site-head { max-width: none; padding: .8rem 1.25rem; border-bottom: 1px solid var(--rule); }
.page-editor .site-foot { display: none; }
.page-editor .flash { max-width: 60rem; margin-top: 1rem; }

.editor { display: flex; flex-direction: column; min-height: calc(100vh - 3.6rem); }
.ed-bar {
  position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: .8rem;
  padding: .6rem 1.25rem; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule); font-family: var(--sans); flex-wrap: wrap;
}
.ed-bar-left, .ed-bar-right { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.chip { font: 600 .72rem var(--sans); text-transform: uppercase; letter-spacing: .08em; padding: .3rem .6rem; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }
.chip-live { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; background: var(--card); }
.seg button { font: 500 .8rem var(--sans); border: 0; background: none; color: var(--ink-2); padding: .38rem .75rem; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.ed-settings {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem;
  padding: 1rem 1.25rem; background: var(--card); border-bottom: 1px solid var(--rule);
}
.slug-wrap { display: flex; align-items: center; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); padding-left: .7rem; font: 400 .9rem var(--mono); }
.slug-wrap > .muted { white-space: nowrap; flex-shrink: 0; }
.slug-wrap input { min-width: 0; border: 0; margin: 0; background: transparent; padding-left: .2rem; font: inherit; box-shadow: none !important; }
.settings-actions { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }

.ed-panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; min-height: 0; }
.ed-panes[data-view="write"] { grid-template-columns: 1fr; }
.ed-panes[data-view="write"] .ed-preview { display: none; }
.ed-panes[data-view="preview"] { grid-template-columns: 1fr; }
.ed-panes[data-view="preview"] .ed-write { display: none; }
.ed-write { display: flex; flex-direction: column; padding: 2rem clamp(1rem, 4vw, 3rem) 1rem; border-right: 1px solid var(--rule); }
.ed-panes[data-view="write"] .ed-write { border-right: 0; width: 100%; max-width: 46rem; margin: 0 auto; }
.ed-preview { padding: 0 clamp(1rem, 4vw, 3rem) 3rem; background: var(--card); overflow-wrap: break-word; }
.ed-panes[data-view="preview"] .ed-preview { background: var(--paper); }
.ed-preview .post { max-width: var(--measure); margin: 0 auto; }

.ed-title {
  font: 800 clamp(2rem, 5vw, 2.8rem)/1.1 var(--display); letter-spacing: -.025em; font-variation-settings: "opsz" 144;
  border: 0; background: none; padding: 0; resize: none; overflow: hidden; box-shadow: none !important;
  min-height: 1.2em;
}
.ed-title::placeholder { color: var(--ink-3); opacity: .6; }
.ed-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center; margin: 1rem 0 .5rem; padding: .3rem;
  border: 1px solid var(--rule); border-radius: 10px; background: var(--card); position: sticky; top: 3.4rem; z-index: 3;
}
.ed-toolbar button {
  font: 500 .85rem var(--sans); min-width: 2.1rem; height: 2.1rem; padding: 0 .55rem; border: 0; background: none;
  border-radius: 6px; color: var(--ink-2); cursor: pointer;
}
.ed-toolbar button:hover { background: var(--paper-2); color: var(--ink); }
.ed-toolbar .sep { width: 1px; height: 1.2rem; background: var(--rule); margin: 0 .3rem; }
.ed-body {
  flex: 1; min-height: 60vh; font: 400 1.12rem/1.75 var(--serif); border: 0; background: none; padding: .5rem 0;
  resize: none; box-shadow: none !important; tab-size: 2;
}
.ed-body.drop { background: var(--accent-soft); border-radius: 8px; }
.ed-foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .6rem 1.25rem; border-top: 1px solid var(--rule); font-family: var(--sans); }
kbd { font: .75rem var(--mono); border: 1px solid var(--rule); border-bottom-width: 2px; padding: 0 .3rem; border-radius: 4px; }

.restore { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; padding: .6rem 1.25rem; background: var(--accent-soft); font: .9rem var(--sans); }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: var(--paper); font: 500 .9rem var(--sans); padding: .7rem 1.1rem; border-radius: 999px; box-shadow: var(--shadow);
}
.toast-err { background: var(--danger); color: #fff; }

@media (max-width: 900px) {
  .ed-panes[data-view="split"] { grid-template-columns: 1fr; }
  .ed-panes[data-view="split"] .ed-write { border-right: 0; border-bottom: 1px solid var(--rule); }
  .ed-body { min-height: 45vh; }
}
@media (max-width: 560px) {
  body { font-size: 1.08rem; }
  .prose { font-size: 1.1rem; }
  .site-head nav { gap: .7rem; }
  .ed-bar-right { width: 100%; }
  .ed-bar-right .btn { flex: 1; }
  .seg { order: -1; width: 100%; justify-content: space-between; }
  .seg button { flex: 1; }
  .neighbours { grid-template-columns: 1fr; }
  .neighbours .next { grid-column: 1; text-align: left; }
}
