/* Only a Fragment — design system
   Light through stained glass: cool stone paper, ink, lapis for action,
   gold kept for the shard alone.

   Breakpoints: phone < 40rem · tablet 40–60rem · laptop ≥ 60rem · wide ≥ 90rem */

:root {
  --paper: #F2F3F5;
  --paper-raised: #FAFAFB;
  --ink: #1A1C2B;
  --ink-soft: #5E6275;
  --rule: #DADCE4;
  --rule-strong: #C3C6D2;
  --lapis: #2E4BA8;
  --lapis-deep: #1E2D6B;
  --on-lapis: #FFFFFF;
  --gold: #B8892E;
  --danger: #B3261E;
  --ok: #2F7D4F;
  --warn: #9A6A00;
  --hover: #E7E9EE;
  --focus: color-mix(in srgb, var(--lapis) 28%, transparent);

  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --page: 90rem;
  --measure: 36rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12131B;
    --paper-raised: #1A1C27;
    --ink: #E7E8EF;
    --ink-soft: #9EA2B5;
    --rule: #2A2D3B;
    --rule-strong: #3A3E50;
    --lapis: #8EA4F0;
    --lapis-deep: #182256;
    --on-lapis: #0F1430;
    --gold: #D9AE5B;
    --danger: #F2938C;
    --ok: #7CC79A;
    --warn: #E3B85C;
    --hover: #222533;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1; }

.wrap {
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

a { color: var(--lapis); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--lapis); outline-offset: 3px; border-radius: 2px; }

::selection { background: color-mix(in srgb, var(--gold) 35%, transparent); }

/* ---------- Shard mark ---------- */
.mark-whole { fill: var(--ink); }
.mark-shard { fill: var(--gold); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.site-header .wrap,
.site-footer .wrap { max-width: none; }

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand svg { width: 1.6rem; height: 1.6rem; flex: none; }

.brand span {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 450;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand:hover { text-decoration: none; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 2rem;
  padding-bottom: 2.5rem;
}

.site-footer p { margin: 0; }
.site-footer .foot-name { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font: 500 0.9375rem/1.2 var(--sans);
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover { background: var(--hover); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); border-color: var(--lapis); }

.btn-primary { background: var(--lapis); border-color: var(--lapis); color: var(--on-lapis); }
.btn-primary:hover { background: color-mix(in srgb, var(--lapis) 88%, var(--ink)); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-quiet:hover { color: var(--ink); background: var(--hover); }

.btn-small { padding: 0.5rem 0.9rem; font-size: 0.875rem; }
.btn-block { width: 100%; padding: 0.85rem 1rem; font-size: 1rem; }

.btn:disabled, .btn[aria-busy="true"] { opacity: 0.6; cursor: default; }

.spinner {
  width: 1em; height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn {
  font: inherit;
  color: var(--lapis);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

/* ---------- Profile avatar + menu ---------- */
.profile { position: relative; flex: none; }

.avatar {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.1);
}

.avatar-btn {
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: box-shadow 0.15s ease;
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px var(--rule-strong); }
.avatar-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus), 0 0 0 1px var(--lapis); }

.avatar-lg { width: 2.75rem; height: 2.75rem; }

.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  width: 16rem;
  max-width: calc(100vw - 2rem);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 18px 40px -12px rgb(16 20 40 / 0.28);
  padding: 0.4rem;
  z-index: 30;
}

.profile-who {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.6rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0.35rem;
  line-height: 1.3;
  min-width: 0;
}

.profile-who > div { min-width: 0; }
.profile-name, .profile-nick { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-name { font-family: var(--serif); font-size: 1.1rem; }
.profile-nick { color: var(--ink-soft); font-size: 0.85rem; }

.profile-link {
  display: block;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  font: 400 0.9375rem/1.3 var(--sans);
  background: none;
  border: 0;
  cursor: pointer;
}
.profile-link:hover { background: var(--hover); text-decoration: none; }

/* ---------- Home ---------- */
.home {
  display: grid;
  gap: 3rem;
  padding-top: clamp(3rem, 9vw, 7rem);
}

.intro {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.1rem, 5.2vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 14ch;
  font-variation-settings: "opsz" 72;
}

.section-title {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.25rem;
  margin-bottom: 0.75rem;
}
.section-head .section-title { margin: 0; }

.posts { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }

/* Each essay is one raised block with a plain "Read essay" button on it. */
.post-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.post-link:hover {
  text-decoration: none;
  border-color: var(--lapis);
  box-shadow: 0 14px 30px -20px rgb(16 20 40 / 0.45);
}
.post-link:hover .post-title { color: var(--lapis); }
.post-link:hover .post-go { background: color-mix(in srgb, var(--lapis) 88%, var(--ink)); }
.post-link:focus-visible { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 3px var(--focus); }
.post-text { min-width: 0; }
.post-go { flex: none; }

@media (min-width: 40rem) {
  .post-link { flex-direction: row; align-items: center; justify-content: space-between; gap: 2rem; }
}

.page-state { margin: 1.5rem 0; color: var(--ink-soft); font-size: 0.9375rem; }
.page-state .btn { margin-left: 0.5rem; }
.page-state-box { max-width: var(--measure); margin: 0 auto; padding-top: clamp(3rem, 8vw, 6rem); }
.page-state-box .back { margin-top: 1.5rem; }
.essay-layout > .page-state, .essay-layout > .page-state-box { grid-column: 1 / -1; }
.essay-layout > .page-state { max-width: var(--measure); margin: clamp(3rem, 8vw, 6rem) auto 0; }

.post-title { color: var(--lapis); }

.post-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  transition: color 0.15s ease;
}

.post-excerpt {
  margin: 0.6rem 0 0.9rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.meta { color: var(--ink-soft); font-size: 0.875rem; }

@media (min-width: 60rem) {
  .home {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(3rem, 7vw, 8rem);
    align-items: start;
  }
  .home .intro { position: sticky; top: 8rem; }
}

/* ---------- Essay ---------- */
.essay-layout { display: block; }
.toc { display: none; }

article { max-width: var(--measure); margin: 0 auto; }

.essay-head { margin: clamp(3rem, 8vw, 6rem) 0 3rem; }

article h1 {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.4rem, 6vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 72;
}

article h2 {
  margin: 3.25rem 0 1rem;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.25;
  scroll-margin-top: 6rem;
}

.essay-body p {
  margin: 0 0 1.35rem;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.75;
  font-variation-settings: "opsz" 16;
  hanging-punctuation: first;
}

.essay-body .closing {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-style: italic;
  font-size: 1.4rem;
  line-height: 1.5;
}

.essay-body blockquote,
.essay-body ul,
.essay-body ol {
  margin: 0 0 1.35rem;
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.75;
  font-variation-settings: "opsz" 16;
}
.essay-body blockquote { padding-left: 1.25rem; border-left: 2px solid var(--rule-strong); font-style: italic; }
.essay-body ul, .essay-body ol { padding-left: 1.5rem; }
.essay-body li { margin-bottom: 0.35rem; }
.essay-body blockquote p, .essay-body li p { margin: 0; font-size: inherit; }

.draft-note {
  display: inline-block;
  margin: 0 0 1.25rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  border-radius: var(--radius);
  color: var(--warn);
  font-size: 0.875rem;
}
.edit-link { margin-left: 0.75rem; }

.back {
  display: inline-block;
  margin-top: 3rem;
  font-size: 0.9375rem;
}

.essay-layout > .back { display: block; max-width: var(--measure); margin: 3rem auto 0; }

@media (min-width: 60rem) {
  .essay-layout {
    display: grid;
    grid-template-columns: 11rem minmax(0, var(--measure));
    justify-content: center;
    column-gap: clamp(2.5rem, 5vw, 6rem);
  }
  .essay-layout article { grid-column: 2; margin: 0; }
  .essay-layout > .back { grid-column: 2; margin: 3rem 0 0; }

  .toc {
    display: block;
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 7rem;
    align-self: start;
    margin-top: clamp(3rem, 8vw, 6rem);
    font-size: 0.875rem;
    line-height: 1.35;
  }
  .toc-title { margin: 0 0 0.75rem; font-size: 0.875rem; font-weight: 500; color: var(--ink); }
  .toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule); }
  .toc li a {
    display: block;
    padding: 0.4rem 0 0.4rem 1rem;
    margin-left: -1px;
    border-left: 2px solid transparent;
    color: var(--ink-soft);
    text-decoration: none;
  }
  .toc li a:hover { color: var(--ink); }
  .toc li a.active { color: var(--ink); border-left-color: var(--gold); }
}

@media (min-width: 90rem) {
  .essay-layout { grid-template-columns: 13rem minmax(0, var(--measure)) 13rem; }
}

/* ---------- Forms (shared) ---------- */
.field { margin-bottom: 1.25rem; }
.field:last-child { margin-bottom: 0; }

.field label, .label-row label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.label-row .link-btn { font-size: 0.875rem; margin-bottom: 0.4rem; }

.hint { color: var(--ink-soft); font-size: 0.8125rem; margin-top: 0.4rem; line-height: 1.45; }

.field input,
.field textarea {
  width: 100%;
  font: 400 1rem/1.4 var(--sans);
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--ink-soft) 75%, transparent); }

.field input:hover, .field textarea:hover { border-color: var(--ink-soft); }

.field input:focus,
.field textarea:focus { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 3px var(--focus); }

.field textarea { min-height: 7rem; resize: vertical; }

.input-wrap { position: relative; }

.input-prefix span {
  position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
}
.input-prefix input { padding-left: 1.75rem; }

.input-action input { padding-right: 3.25rem; }
.reveal-btn {
  position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
  width: 2.5rem; height: 2.25rem;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--radius);
  color: var(--ink-soft);
  cursor: pointer;
}
.reveal-btn:hover { color: var(--ink); background: var(--hover); }
.reveal-btn svg { width: 1.15rem; height: 1.15rem; }

.field.invalid input, .field.invalid textarea { border-color: var(--danger); }
.field.invalid input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }

.error, .form-error { color: var(--danger); font-size: 0.8125rem; margin-top: 0.4rem; line-height: 1.45; }
.form-error { font-size: 0.875rem; margin: 0 0 1rem; }

.suggest { font-size: 0.8125rem; margin-top: 0.4rem; color: var(--ink-soft); }

.caps { color: var(--warn); font-size: 0.8125rem; margin-top: 0.4rem; }

/* Password strength */
.strength { margin-top: 0.7rem; }

.strength-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength-bar span { height: 4px; border-radius: 2px; background: var(--rule); transition: background-color 0.2s ease; }

.strength[data-score="1"] .strength-bar span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] .strength-bar span:nth-child(-n+2) { background: var(--warn); }
.strength[data-score="3"] .strength-bar span:nth-child(-n+3) { background: var(--lapis); }
.strength[data-score="4"] .strength-bar span:nth-child(-n+4) { background: var(--ok); }

.strength-label { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--ink-soft); margin-top: 0.45rem; }
.strength-label strong { font-weight: 500; color: var(--ink); }

.rules { list-style: none; margin: 0.6rem 0 0; padding: 0; display: grid; gap: 0.3rem 1rem; font-size: 0.8125rem; color: var(--ink-soft); }
@media (min-width: 26rem) { .rules { grid-template-columns: 1fr 1fr; } }
.rules li { display: flex; align-items: center; gap: 0.45rem; }
.rules li::before {
  content: ""; width: 0.9rem; height: 0.9rem; flex: none;
  border-radius: 50%; border: 1.5px solid var(--rule-strong);
}
.rules li.met { color: var(--ink); }
.rules li.met::before {
  border-color: var(--ok);
  background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
}

/* ---------- Sign in ---------- */
.auth { display: grid; min-height: calc(100vh - 4.25rem); }

.auth-art { display: none; margin: 0; }

.auth-panel {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(2.5rem, 8vw, 5rem) var(--gutter) 4rem;
}

.auth-card { width: 100%; max-width: 25rem; }

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.auth-card .lede { margin: 0 0 2rem; color: var(--ink-soft); font-size: 0.9375rem; }

.notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: color-mix(in srgb, var(--lapis) 8%, var(--paper-raised));
  border: 1px solid color-mix(in srgb, var(--lapis) 30%, transparent);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
}
.notice .link-btn { font-size: inherit; }

.auth-foot {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  text-align: center;
}

.auth-small { margin-top: 1.25rem; font-size: 0.8125rem; color: var(--ink-soft); text-align: center; line-height: 1.5; }

@media (min-width: 60rem) {
  .auth { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .site-footer.auth-footer { display: none; }

  .auth-art {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3rem;
    padding: 4rem clamp(3rem, 6vw, 7rem);
    background: var(--lapis-deep);
    color: #E9ECF7;
    position: relative;
    overflow: hidden;
  }

  .auth-art svg { width: clamp(9rem, 16vw, 14rem); height: auto; }
  .auth-art .mark-whole { fill: #E9ECF7; }
  .auth-art .mark-shard {
    fill: #D9AE5B;
    transform-box: fill-box;
    transform-origin: 30% 70%;
    animation: shard-in 1.4s cubic-bezier(0.2, 0.7, 0.1, 1) 0.2s both;
  }

  .auth-art blockquote {
    margin: 0;
    font-family: var(--serif);
    font-weight: 300;
    font-size: clamp(1.75rem, 2.6vw, 2.5rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    max-width: 16ch;
  }

  .auth-art figcaption { margin-top: 1rem; font-size: 0.9375rem; color: #AEB6DA; }

  .auth-panel { align-items: center; padding-top: 4rem; }
}

@keyframes shard-in {
  from { transform: translate(18px, -18px) rotate(14deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---------- Settings ---------- */
.settings { padding-bottom: 2rem; }

.page-head { margin: clamp(3rem, 7vw, 5rem) 0 2.5rem; }
.page-head h1 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 4.5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.page-head p { margin: 0; color: var(--ink-soft); font-size: 0.9375rem; }

.settings-grid { display: grid; gap: 1.5rem; }

.panel {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: clamp(1.25rem, 3vw, 2rem);
  margin: 0;
  min-width: 0;
}

.panel-title { margin: 0 0 0.3rem; font-family: var(--serif); font-weight: 400; font-size: 1.35rem; }
.panel-sub { margin: 0 0 1.5rem; color: var(--ink-soft); font-size: 0.875rem; }

.photo-row { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.avatar-xl { width: 6rem; height: 6rem; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

@media (min-width: 40rem) {
  .field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
  .field-pair .field:last-child { margin-bottom: 1.25rem; }
}

@media (min-width: 60rem) {
  .settings { max-width: 68rem; }
  .settings-grid { grid-template-columns: 18rem minmax(0, 1fr); align-items: start; }
  .settings-grid .photo-row { flex-direction: column; align-items: flex-start; }
  .avatar-xl { width: 8.5rem; height: 8.5rem; }
  .photo-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .settings-grid .security { grid-column: 2; }
}

.save-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.status { color: var(--ink-soft); font-size: 0.875rem; margin: 0.75rem 0 0; }
.save-row .status { margin: 0; }
.status:empty { display: none; }

/* ---------- Writing: list ---------- */
.write-list-page { max-width: 56rem; }
.write-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.write-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.write-list li { border-bottom: 1px solid var(--rule); }
.write-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 1rem;
  padding: 1rem 0.75rem;
  margin: 0 -0.75rem;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.write-row:hover { background: var(--hover); text-decoration: none; }
.write-title { font-family: var(--serif); font-size: 1.3rem; line-height: 1.25; overflow-wrap: anywhere; }
.write-row .meta { grid-column: 1 / -1; }

.chip {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}
.chip-live { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }

/* ---------- Writing: editor ---------- */
.ed-bar {
  position: sticky;
  top: calc(4.25rem + 1px);
  z-index: 15;
  padding: 0.5rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.ed-bar-row, .ed-tools { max-width: 52rem; margin: 0 auto; }
.ed-bar-row { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 1rem; }
.ed-back { font-size: 0.875rem; white-space: nowrap; }
.ed-status { flex: 1; min-width: 7rem; color: var(--ink-soft); font-size: 0.875rem; }
.ed-status.is-dirty { color: var(--warn); }
.ed-actions { display: flex; align-items: center; gap: 0.5rem; }
.ed-more { position: relative; }
.ed-menu { width: 14rem; }
.ed-danger { color: var(--danger); }

.btn-danger { background: var(--danger); border-color: var(--danger); color: var(--paper-raised); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, var(--ink)); }

.ed-tools { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.5rem; }
.ed-tool {
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  color: var(--ink);
  font: 500 0.875rem/1 var(--sans);
  cursor: pointer;
}
.ed-tool:hover { background: var(--hover); }
.ed-tool[aria-pressed="true"] {
  background: color-mix(in srgb, var(--lapis) 14%, transparent);
  border-color: color-mix(in srgb, var(--lapis) 40%, transparent);
  color: var(--lapis);
}
@media (max-width: 39.99rem) {
  .ed-tools { flex-wrap: nowrap; overflow-x: auto; gap: 0; }
  .ed-tool { flex: 1 0 auto; padding: 0 0.45rem; }
  .ed-chapter-head { flex-wrap: wrap; gap: 0; }
  .ed-chapter-title { flex-basis: 100%; }
  .ed-chapter-tools { margin-left: auto; }
}
.ed-tool-bold { font-weight: 700; }
.ed-tool-italic { font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.ed-tool-underline { text-decoration: underline; text-underline-offset: 0.2em; }

.ed-page {
  box-sizing: content-box;
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) var(--gutter) 2rem;
}
.ed-note { max-width: 52rem; margin: 0.4rem auto 0; color: var(--ink-soft); font-size: 0.875rem; }
.ed-note.form-error { color: var(--danger); }

.ed-title, .ed-summary, .ed-closing, .ed-chapter-title {
  display: block;
  width: 100%;
  padding: 0.15rem 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  border-radius: 0;
  background: none;
  color: var(--ink);
  resize: none;
  overflow: hidden;
}
.ed-title:hover, .ed-summary:hover, .ed-closing:hover, .ed-chapter-title:hover { border-bottom-color: var(--rule-strong); }
.ed-title:focus, .ed-summary:focus, .ed-closing:focus, .ed-chapter-title:focus { outline: none; border-bottom-color: var(--lapis); }
.ed-page ::placeholder { color: color-mix(in srgb, var(--ink-soft) 70%, transparent); }

.ed-title {
  font: 300 clamp(2.4rem, 6vw, 4.25rem)/1.04 var(--serif);
  letter-spacing: -0.025em;
  font-variation-settings: "opsz" 72;
}
.ed-summary { margin-top: 0.75rem; color: var(--ink-soft); font: 400 1.15rem/1.5 var(--serif); }

.ed-chapter { margin-top: 2.5rem; }
.ed-chapter-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.ed-chapter-title { flex: 1; min-width: 0; font: italic 400 1.5rem/1.25 var(--serif); }
.ed-chapter-tools { display: flex; flex: none; }

.ed-body {
  position: relative;
  min-height: 7rem;
  margin: 0 -1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  overflow-wrap: anywhere;
}
.ed-body:focus { outline: none; border-color: var(--lapis); box-shadow: 0 0 0 3px var(--focus); }
.ed-body > :last-child { margin-bottom: 0; }
.ed-body.is-empty::before {
  content: attr(data-placeholder);
  position: absolute;
  top: 0.9rem;
  left: 1rem;
  color: color-mix(in srgb, var(--ink-soft) 70%, transparent);
  font: 400 1.1875rem/1.75 var(--serif);
  pointer-events: none;
}

.ed-add { margin-top: 1.5rem; }
.ed-closing {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font: italic 400 1.4rem/1.5 var(--serif);
}

.ask {
  width: min(26rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 0 24px 60px -16px rgb(16 20 40 / 0.4);
}
.ask::backdrop { background: rgb(10 12 24 / 0.45); }
.ask #ask-text { margin: 0 0 1.25rem; }
.ask-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
