/* sushantp.com: calm paper-and-ink palette, light + dark, no external assets. */
:root {
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-2: #efeae2;
  --ink: #1f1d1a;
  --ink-2: #57524b;
  --line: #e2dbd0;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #dcebe5;
  --danger: #a8402f;
  --warn-soft: #f6e7c8;
  --focus: #2f6f5e55;
  --shadow: 0 1px 2px #1f1d1a0d, 0 4px 16px #1f1d1a0a;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412; --surface: #1d1c19; --surface-2: #262420; --ink: #ece7df; --ink-2: #a9a298;
    --line: #34312c; --accent: #6fbfa6; --accent-ink: #0f1f1a; --accent-soft: #22362f; --danger: #e0806f;
    --warn-soft: #3a3120; --focus: #6fbfa655; --shadow: 0 1px 2px #0006, 0 6px 20px #0004; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151412; --surface: #1d1c19; --surface-2: #262420; --ink: #ece7df; --ink-2: #a9a298;
  --line: #34312c; --accent: #6fbfa6; --accent-ink: #0f1f1a; --accent-soft: #22362f; --danger: #e0806f;
  --warn-soft: #3a3120; --focus: #6fbfa655; --shadow: 0 1px 2px #0006, 0 6px 20px #0004; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); }
h2 { font-size: 1.2rem; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px;
  padding: 24px 16px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.2rem; font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 1.05rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: 9px 12px; border-radius: 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--ink); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 0 12px; }
.main { padding: 32px clamp(16px, 4vw, 48px) 64px; max-width: 1100px; width: 100%; }
.main.public { margin: 0 auto; max-width: 760px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar { flex-wrap: wrap; }
.topbar-nav { display: flex; align-items: center; gap: 16px; margin-left: auto; white-space: nowrap; }
.topbar-nav a:not(.button) { color: var(--ink-2); text-decoration: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; overflow-x: auto; width: 100%; min-width: 0; order: 3; padding-bottom: 2px; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; gap: 14px; padding: 0; }
  .sidebar-foot a.quiet { display: none; }
  .main { padding-top: 24px; }
}

/* Building blocks */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--ink-2); font-size: 0.85rem; letter-spacing: 0.02em; }
.muted { color: var(--ink-2); }
.small { font-size: 0.85rem; }
.quiet { color: var(--ink-2); text-decoration: none; font-size: 0.92rem; }
.quiet:hover { color: var(--ink); text-decoration: underline; }
.empty { color: var(--ink-2); padding: 24px 0; }
.notice { background: var(--warn-soft); padding: 12px 14px; border-radius: 10px; font-size: 0.92rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.narrow { max-width: 520px; margin: 32px auto; }
.card.center { text-align: center; }
.card-title { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.foot { margin: 14px 0 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font: 500 0.95rem var(--sans);
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.button:hover { filter: brightness(1.06); }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button.ghost:hover { background: var(--surface-2); }
.button.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.button.danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.button.small { padding: 5px 11px; font-size: 0.85rem; border-radius: 8px; }
.button[disabled] { opacity: 0.45; cursor: default; }
.button-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.button-row form { display: contents; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; font-size: 0.92rem; }
.link-button:hover { color: var(--ink); text-decoration: underline; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 0.78rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.badge.public { background: var(--accent-soft); color: var(--ink); }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.segmented a { padding: 7px 14px; color: var(--ink-2); text-decoration: none; font-size: 0.9rem; }
.segmented a.active { background: var(--accent-soft); color: var(--ink); }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 0.93rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input:not([type="checkbox"]):not([type="file"]), textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: 1rem var(--sans); }
textarea { resize: vertical; line-height: 1.55; }
.editor textarea { font-family: var(--mono); font-size: 0.95rem; }
input[type="file"] { font: 0.9rem var(--sans); color: var(--ink-2); max-width: 100%; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.search { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.search input { max-width: 420px; }
.upload { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.upload label { flex: 1 1 280px; }

/* Flash messages */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.93rem; }
.flash-success { background: var(--accent-soft); border-color: transparent; }
.flash-error { background: var(--warn-soft); border-color: transparent; color: var(--ink); }

/* Home */
.hero { padding: clamp(40px, 10vh, 110px) 0; }
.hero h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); max-width: 16ch; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 46ch; margin: 18px 0 28px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.stat:hover { border-color: var(--accent); }
.stat.attention { background: var(--accent-soft); border-color: transparent; }
.stat-value { font-family: var(--serif); font-size: 1.8rem; font-weight: 600; line-height: 1.1; }
.stat-label { color: var(--ink-2); font-size: 0.85rem; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list li > a { display: flex; flex-direction: column; min-width: 0; color: var(--ink); text-decoration: none; }
.list li > a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.list li > a:hover strong { text-decoration: underline; }
.list li > time, .list li > .badge { flex-shrink: 0; white-space: nowrap; }

/* Notes */
.note-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.note-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.note-card:hover { border-color: var(--accent); }
.note-card p { margin: 0; flex: 1; font-size: 0.93rem; }
.prose { font-size: 1.04rem; line-height: 1.7; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose pre { background: var(--surface-2); padding: 14px; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; }
.prose blockquote { margin: 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--ink-2); }

/* Inbox */
.inbox, .pages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.inbox-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; }
.inbox-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--ink); text-decoration: none; }
.inbox-main span { overflow-wrap: anywhere; font-size: 0.93rem; }
.inbox-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 600px) { .inbox-item { flex-direction: column; align-items: stretch; } }

/* Pages */
.page-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; padding: 14px 16px; }
.page-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.page-title { font-weight: 600; color: var(--ink); text-decoration: none; }
.page-title:hover { text-decoration: underline; }
.page-settings { grid-column: 1 / -1; }
.page-settings summary, .archived summary { cursor: pointer; color: var(--ink-2); font-size: 0.9rem; }
.page-settings[open] { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.page-settings > * + * { margin-top: 12px; }
.page-settings .button-row form { display: inline-flex; gap: 8px; }
.archived { margin-top: 20px; }

/* Files */
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th, .table td { padding: 10px 16px; text-align: left; border-top: 1px solid var(--line); }
.table thead th { border-top: 0; color: var(--ink-2); font-weight: 500; font-size: 0.82rem; }
.table .num { text-align: right; white-space: nowrap; }
.table .filename { overflow-wrap: anywhere; min-width: 180px; }
.table .actions { text-align: right; }

/* Calendar */
.cal-grid { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.cal-grid th { color: var(--ink-2); font-weight: 500; font-size: 0.8rem; padding-bottom: 4px; }
.cal-grid td { text-align: center; padding: 0; }
.cal-grid td span { display: grid; place-items: center; height: 44px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.cal-grid.compact td span { height: 32px; font-size: 0.88rem; }
.cal-grid .wk { color: var(--ink-2); font-size: 0.75rem; width: 2.6em; }
.cal-grid td.out span { color: var(--ink-2); opacity: 0.45; }
.cal-grid td.weekend span { color: var(--ink-2); }
.cal-grid tr.this-week td:not(.wk) span { background: var(--surface-2); }
.cal-grid td.today span { background: var(--accent) !important; color: var(--accent-ink) !important; font-weight: 600; opacity: 1; }

/* Options */
.kv-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 8px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 0; }
.kv-grid dt { margin: 0; color: var(--ink-2); font-size: 0.8rem; }
.kv-grid dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
