/* The writing desk */

body { background: var(--paper); min-height: 100vh; font-size: 1.05rem; }
.boot { text-align: center; padding: 30vh 0; font-family: var(--hand); font-size: 2rem; color: var(--ink-soft); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.login-card {
  width: min(420px, 100%); padding: 2.2rem 2rem 2rem; text-align: center; display: grid; gap: 0.9rem;
  background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--blob); box-shadow: 8px 8px 0 var(--gold);
}
.login-card h1 { font-size: 2.3rem; }
.login-card p { color: var(--ink-soft); }
.login-card .drop { color: var(--rose); margin: 0 auto; }
.login-card .btn { justify-self: center; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; padding: 1.6rem 1.2rem; display: flex; flex-direction: column; gap: 0.3rem;
  background: var(--paper-2); border-right: 1.5px dashed var(--line);
}
.side .brand { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1.4rem; font-family: var(--display); font-weight: 600; font-size: 1.4rem; text-decoration: none; font-variation-settings: 'SOFT' 100, 'WONK' 1; }
.side .brand i { color: var(--rose); }
.side .brand svg { color: var(--rose); }
.side small { font-family: var(--hand); font-size: 1.15rem; color: var(--rose); margin: -1rem 0 1.2rem 1.9rem; }
.side nav { display: grid; gap: 0.25rem; }
.side nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.55em 0.8em; text-decoration: none;
  font-family: var(--display); font-weight: 500; font-size: 1rem; border-radius: var(--blob); border: 1.5px solid transparent;
}
.side nav a:hover { background: color-mix(in srgb, var(--gold) 16%, transparent); }
.side nav a[aria-current='page'] { background: var(--card); border-color: var(--ink); box-shadow: 3px 3px 0 var(--gold); }
.side nav a span { font-size: 0.85rem; opacity: 0.6; font-family: var(--serif); }
.side-foot { margin-top: auto; display: grid; gap: 0.4rem; }
.side-foot a, .side-foot button { font: inherit; font-size: 0.95rem; text-align: left; padding: 0.4em 0.8em; background: none; border: 0; cursor: pointer; color: var(--ink-soft); text-decoration: none; border-radius: 8px; }
.side-foot a:hover, .side-foot button:hover { color: var(--rose); background: color-mix(in srgb, var(--rose) 10%, transparent); }

.main { padding: clamp(1.4rem, 4vw, 3rem); max-width: 1000px; width: 100%; }
.main > header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.main h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); }
.note { font-family: var(--hand); font-size: 1.5rem; color: var(--rose); line-height: 1.1; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0.8rem 1rem; border-right: 0; border-bottom: 1.5px dashed var(--line); }
  .side .brand { margin: 0 auto 0 0; }
  .side small { display: none; }
  .side nav { display: flex; flex-wrap: wrap; width: 100%; order: 3; gap: 0.2rem; }
  .side nav a { padding: 0.4em 0.7em; font-size: 0.95rem; }
  .side-foot { margin: 0; display: flex; gap: 0.2rem; }
}

/* ---------- dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1.4rem; margin-bottom: 2.4rem; }
.stat {
  --accent: var(--gold); display: grid; gap: 0.2rem; padding: 1.1rem 1.2rem; text-decoration: none; background: var(--card);
  border: 1.5px solid var(--ink); border-radius: var(--blob); box-shadow: 5px 5px 0 var(--accent); transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.stat:hover { transform: translate(-2px, -2px) rotate(-0.5deg); box-shadow: 7px 7px 0 var(--accent); }
.stat b { font-family: var(--display); font-size: 2.6rem; line-height: 1; font-weight: 600; }
.stat span { color: var(--ink-soft); }
.quick { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2.6rem; }
.panel { margin-bottom: 2rem; }
.panel h2 { font-size: 1.6rem; margin-bottom: 0.8rem; }
.empty { font-family: var(--hand); font-size: 1.5rem; color: var(--ink-soft); }

/* ---------- lists ---------- */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1.5px dashed var(--line); }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 0.4rem 1.2rem; align-items: center; padding: 1rem 0.3rem; border-bottom: 1.5px dashed var(--line);
}
.row-title { font-family: var(--display); font-weight: 600; font-size: 1.25rem; text-decoration: none; line-height: 1.2; }
.row-title:hover { color: var(--rose); }
.row-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; align-items: center; color: var(--ink-soft); font-size: 0.95rem; }
.row-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; gap: 0.5rem; align-items: center; }
.pill { font-family: var(--hand); font-size: 1.1rem; line-height: 1.2; padding: 0 0.7em 0.05em; border: 1.5px solid currentColor; border-radius: 999px; }
.pill.live { color: var(--sage); }
.pill.draft { color: var(--gold); }
.pill.sample { color: var(--sky); }
.link-btn { font: inherit; font-size: 0.95rem; background: none; border: 0; cursor: pointer; padding: 0.3em 0.6em; color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; border-radius: 6px; }
.link-btn:hover { color: var(--rose); }
.link-btn.danger:hover { color: #d1445a; }
.readers-tools { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 260px; gap: 2rem; align-items: start; }
.fields { display: grid; gap: 1.4rem; min-width: 0; }
.side-box {
  position: sticky; top: 1.2rem; display: grid; gap: 1rem; padding: 1.2rem; background: var(--card);
  border: 1.5px solid var(--ink); border-radius: var(--blob-2); box-shadow: 5px 5px 0 var(--rose);
}
.side-box h3 { font-size: 1.2rem; }
.side-box .btn { justify-content: center; width: 100%; }
.status-line { display: flex; align-items: center; gap: 0.6rem; }
.hint { font-size: 0.92rem; color: var(--ink-soft); line-height: 1.4; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } .side-box { position: static; } }

label.f { display: grid; gap: 0.35rem; }
.f > span, .f-label { font-family: var(--display); font-weight: 600; font-size: 0.95rem; }
input[type='text'], input[type='url'], input[type='password'], input[type='date'], input[type='email'], select, textarea {
  width: 100%; padding: 0.65em 0.9em; background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px; font-size: 1.05rem; line-height: 1.5;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2.5px dashed var(--rose); outline-offset: 3px; }
input.title-input { font-family: var(--display); font-variation-settings: 'SOFT' 100, 'WONK' 1; font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 600; padding: 0.4em 0.6em; line-height: 1.15; }
textarea { resize: vertical; font-family: var(--serif); line-height: 1.7; font-size: 1.15rem; }

.md { display: grid; border: 1.5px solid var(--ink); border-radius: 14px; background: var(--card); overflow: hidden; }
.md-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.4rem 0.5rem; background: var(--paper-2); border-bottom: 1.5px dashed var(--line); }
.md-bar button { font-family: var(--display); font-size: 0.95rem; min-width: 2.1rem; height: 2.1rem; padding: 0 0.5rem; background: transparent; border: 1.5px solid transparent; border-radius: 8px; cursor: pointer; }
.md-bar button:hover, .md-bar button[aria-pressed='true'] { border-color: var(--ink); background: var(--card); }
.md-bar .spacer { flex: 1; }
.md-count { font-size: 0.9rem; color: var(--ink-soft); padding-right: 0.5rem; }
.md textarea { border: 0; border-radius: 0; background: transparent; min-height: 240px; }
.md-prev { padding: 1rem 1.4rem 0.4rem; min-height: 240px; }

.swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.swatch { width: 40px; height: 54px; border: 1.5px solid var(--ink); border-radius: 3px 8px 8px 3px; cursor: pointer; background: var(--bg); position: relative; }
.swatch[aria-pressed='true'] { outline: 2.5px solid var(--rose); outline-offset: 3px; transform: translateY(-3px); }
.star-pick { display: flex; gap: 0.2rem; }
.star-pick button { background: none; border: 0; cursor: pointer; font-size: 1.7rem; line-height: 1; color: var(--line); padding: 0.1em; transition: transform 0.15s var(--ease); }
.star-pick button.on { color: var(--gold); }
.star-pick button:hover { transform: scale(1.2) rotate(12deg); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 600px) { .two-col { grid-template-columns: 1fr; } }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-family: var(--display); font-size: 0.9rem; padding: 0.5rem 0.4rem; border-bottom: 1.5px solid var(--ink); }
.table td { padding: 0.7rem 0.4rem; border-bottom: 1.5px dashed var(--line); font-size: 0.98rem; word-break: break-word; }
.table-wrap { overflow-x: auto; }
.error { color: #d1445a; min-height: 1.3em; font-size: 0.98rem; }

#toast {
  position: fixed; left: 50%; bottom: 1.6rem; z-index: 50; translate: -50% 20px; opacity: 0; pointer-events: none; padding: 0.7em 1.3em;
  background: var(--ink); color: var(--on-ink); border-radius: var(--blob); box-shadow: 4px 4px 0 var(--gold); font-family: var(--display); font-size: 0.98rem;
  transition: opacity 0.3s, translate 0.4s var(--ease);
}
#toast.show { opacity: 1; translate: -50% 0; }

/* ---------- photo picker ---------- */
.img-pick { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: center; }
.img-prev {
  width: 132px; aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; text-align: center; padding: 0.4rem;
  background: var(--paper-2); color: var(--ink-soft); font-size: 0.9rem; border: 1.5px dashed var(--ink); border-radius: 66px 66px 12px 12px;
}
.img-prev img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; margin: -0.4rem; width: calc(100% + 0.8rem); height: calc(100% + 0.8rem); max-width: none; }
.img-actions { display: grid; gap: 0.5rem; justify-items: start; }
.img-actions .btn { cursor: pointer; }
.img-msg { min-height: 1.3em; }

/* ---------- site wording & password ---------- */
.wording-intro { max-width: 60ch; margin-bottom: 1.6rem; font-size: 1rem; }
.word-fields { display: grid; gap: 1rem; margin-top: 0.8rem; }
.word { display: grid; gap: 0.15rem; justify-items: start; }
.word label.f { width: 100%; }
.word textarea { min-height: 0; font-family: var(--serif); font-size: 1.05rem; line-height: 1.5; }
.wording .panel { padding: 1.4rem 1.5rem 1.6rem; margin-bottom: 1.6rem; background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--blob-2); box-shadow: 5px 5px 0 var(--gold); }
.save-bar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 1rem; padding: 0.9rem 0; background: linear-gradient(transparent, var(--paper) 40%); }
.pw-panel { margin-top: 3rem; max-width: 420px; }
.pw-form { display: grid; gap: 1rem; margin-top: 0.8rem; justify-items: start; }
.pw-form label { width: 100%; }
.backup-panel { max-width: 560px; margin-bottom: 3rem; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0.9rem 0; }
.backup-actions .btn { cursor: pointer; }
