/* I'm With You. A night window: ink-blue dark, warm lamp light, notes that glow as people say "I'm with you". */
:root {
  color-scheme: dark;
  --night: #10131c;
  --raise: #1a1f2e;
  --line: #2a3045;
  --paper: #efe7d8;
  --muted: #a6abbb;
  --lamp: #f2c879;
  --lamp-ink: #2a1f0c;
  --danger: #f1a7a0;
  --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;
  --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: var(--sans);
  line-height: 1.5;
  background: radial-gradient(900px 520px at 10% -8%, rgba(242, 200, 121, 0.1), transparent 62%), var(--night);
}
a { color: var(--lamp); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; font-family: var(--serif); font-size: 1.2rem; }
.brand img { display: block; width: 28px; height: 28px; }
.help-link {
  border: 1px solid rgba(242, 200, 121, 0.45);
  border-radius: 999px;
  color: var(--lamp);
  font-size: 0.9rem;
  padding: 8px 15px;
  text-decoration: none;
  white-space: nowrap;
}
.help-link:hover { background: rgba(242, 200, 121, 0.12); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 540px);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
  padding: clamp(28px, 7vw, 88px) 0 clamp(40px, 6vw, 72px);
}
h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.9rem, 7.4vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 20px;
  text-wrap: balance;
}
.tagline { color: var(--muted); font-size: 1.15rem; margin: 0; }

/* The composer is a blank note that is already lit. */
.composer {
  background: linear-gradient(180deg, #2c2519, #231e15);
  border: 1px solid rgba(242, 200, 121, 0.32);
  border-radius: 6px;
  padding: 20px 22px 16px;
  box-shadow: 0 0 70px rgba(242, 200, 121, 0.1), 0 18px 40px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s;
}
.composer:focus-within { border-color: rgba(242, 200, 121, 0.7); }
.prompt { display: block; color: var(--muted); font-family: var(--serif); font-size: 1rem; font-style: italic; margin-bottom: 10px; }
.composer textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--paper);
  font: 400 1.2rem/1.55 var(--serif);
  outline: none;
}
.composer textarea::placeholder { color: rgba(239, 231, 216, 0.4); }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.hint { color: var(--muted); font-size: 0.85rem; }
.share-btn {
  background: var(--lamp);
  border: 0;
  border-radius: 999px;
  color: var(--lamp-ink);
  cursor: pointer;
  font: 600 0.95rem var(--sans);
  padding: 10px 22px;
  transition: opacity 0.2s, transform 0.1s;
}
.share-btn:hover:not(:disabled) { transform: translateY(-1px); }
.share-btn:disabled { cursor: not-allowed; opacity: 0.4; }

.notice {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.95rem;
  margin-top: 14px;
  padding: 14px 16px;
}
.notice p { margin: 0 0 10px; }
.notice p:last-child { margin-bottom: 0; }
.help-lines ul { list-style: none; margin: 0 0 10px; padding: 0; }
.help-lines li { margin: 6px 0; }
.help-lines a { font-weight: 600; }

/* ---------- Wall ---------- */
.wall-head { margin-bottom: 24px; }
.wall-head h2 { font-family: var(--serif); font-size: 1.7rem; font-weight: 400; margin: 0 0 6px; }
.wall-head p { color: var(--muted); margin: 0; max-width: 60ch; }
.cols { display: flex; gap: 20px; align-items: flex-start; }
.col { display: flex; flex: 1; flex-direction: column; gap: 20px; min-width: 0; }
.empty { color: var(--muted); font-family: var(--serif); font-size: 1.2rem; font-style: italic; padding: 32px 0; }

.note {
  --glow: 0;
  --tilt: 0deg;
  background: var(--note-bg);
  border: 1px solid var(--note-line);
  border-radius: 5px;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.35),
    0 0 calc(8px + 64px * var(--glow)) rgba(242, 200, 121, calc(0.02 + 0.34 * var(--glow)));
  padding: 18px 18px 14px;
  transform: rotate(var(--tilt));
  transition: box-shadow 0.8s ease;
}
.c-amber { --note-bg: #2e271d; --note-line: #4a3d28; }
.c-sage  { --note-bg: #1d2a26; --note-line: #33493f; }
.c-dusk  { --note-bg: #1c2540; --note-line: #2f3c63; }
.c-rose  { --note-bg: #2e1f28; --note-line: #4d3341; }
.c-lilac { --note-bg: #25213a; --note-line: #3d3660; }
.c-sand  { --note-bg: #2a2822; --note-line: #433f33; }

.note-text { font-family: var(--serif); font-size: 1.12rem; line-height: 1.55; margin: 0 0 14px; overflow-wrap: anywhere; white-space: pre-wrap; }
.note-foot { align-items: center; color: var(--muted); display: flex; flex-wrap: wrap; font-size: 0.82rem; gap: 8px 12px; justify-content: space-between; }
.note-meta { align-items: center; display: flex; gap: 12px; }
.linkish {
  background: none; border: 0; color: inherit; cursor: pointer; font: inherit; padding: 2px 0;
  text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px;
}
.linkish:hover:not(:disabled) { color: var(--paper); text-decoration-color: currentColor; }
.linkish:disabled { cursor: default; opacity: 0.7; }

.with-you {
  align-items: center;
  background: transparent;
  border: 1px solid rgba(242, 200, 121, 0.4);
  border-radius: 999px;
  color: var(--paper);
  cursor: pointer;
  display: inline-flex;
  font: 0.85rem var(--sans);
  gap: 8px;
  padding: 7px 13px;
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.with-you::before {
  border: 1.5px solid var(--lamp);
  border-radius: 50%;
  content: "";
  height: 8px;
  transition: background 0.25s, box-shadow 0.25s;
  width: 8px;
}
.with-you:hover:not([aria-pressed="true"]) { border-color: var(--lamp); }
.with-you[aria-pressed="true"] { background: rgba(242, 200, 121, 0.16); border-color: var(--lamp); color: var(--lamp); cursor: default; }
.with-you[aria-pressed="true"]::before { background: var(--lamp); box-shadow: 0 0 9px var(--lamp); }
.with-you .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.with-you[aria-pressed="true"] .n { color: var(--lamp); }

@keyframes arrive {
  from { opacity: 0; transform: translateY(-10px) rotate(var(--tilt)); box-shadow: 0 0 60px rgba(242, 200, 121, 0.45); }
  to { opacity: 1; transform: translateY(0) rotate(var(--tilt)); }
}
.note.arrive { animation: arrive 0.9s ease-out both; }

.toast {
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 999px;
  bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  left: 50%;
  max-width: calc(100vw - 32px);
  opacity: 0;
  padding: 10px 20px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s, transform 0.25s;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; margin-top: 72px; padding: 28px 0 56px; }
.site-foot p { margin: 0 0 10px; max-width: 62ch; }
.site-foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--paper); }

/* ---------- Text pages (help, terms, privacy) ---------- */
.prose { max-width: 680px; padding: clamp(16px, 4vw, 48px) 0 0; }
.prose h1 { font-size: clamp(2.2rem, 5vw, 3.2rem); margin-bottom: 14px; }
.prose h2 { font-family: var(--serif); font-size: 1.45rem; font-weight: 400; margin: 40px 0 10px; }
.prose p, .prose li { font-size: 1.02rem; line-height: 1.7; }
.prose ul { padding-left: 1.2em; }
.prose .lede { color: var(--muted); font-size: 1.15rem; }
.updated { color: var(--muted); font-size: 0.9rem; }
.prose .lines { display: grid; gap: 14px; margin: 18px 0; padding: 0; list-style: none; }
.lines li { background: var(--raise); border: 1px solid var(--line); border-radius: 6px; padding: 16px 18px; }
.lines strong { display: block; font-family: var(--serif); font-size: 1.15rem; font-weight: 400; margin-bottom: 4px; }
.lines .nums { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 1.05rem; }
.lines .nums a { font-weight: 600; }
.lines small { color: var(--muted); display: block; margin-top: 6px; }
.urgent { border-color: rgba(241, 167, 160, 0.55) !important; }

/* ---------- Admin ---------- */
.admin { max-width: 860px; padding-top: 16px; }
.admin h1 { font-size: 2.4rem; }
.admin-bar { align-items: center; display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.admin input[type="password"], .admin select {
  background: var(--raise); border: 1px solid var(--line); border-radius: 6px; color: var(--paper); font: 1rem var(--sans); padding: 10px 12px;
}
.btn { background: transparent; border: 1px solid var(--line); border-radius: 999px; color: var(--paper); cursor: pointer; font: 0.9rem var(--sans); padding: 7px 14px; }
.btn:hover { border-color: var(--lamp); }
.btn.primary { background: var(--lamp); border-color: var(--lamp); color: var(--lamp-ink); font-weight: 600; }
.btn.danger { border-color: rgba(241, 167, 160, 0.6); color: var(--danger); }
.older { display: block; margin: 32px auto 0; padding: 10px 22px; }
.admin-item { background: var(--raise); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 12px; padding: 14px 16px; }
.admin-item p { font-family: var(--serif); font-size: 1.05rem; margin: 0 0 10px; overflow-wrap: anywhere; white-space: pre-wrap; }
.admin-meta { color: var(--muted); display: flex; flex-wrap: wrap; font-size: 0.85rem; gap: 6px 14px; margin-bottom: 10px; }
.badge { border: 1px solid var(--line); border-radius: 999px; font-size: 0.78rem; padding: 1px 9px; }
.badge.hidden { border-color: rgba(241, 167, 160, 0.6); color: var(--danger); }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.err { color: var(--danger); }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .composer { padding: 16px 16px 14px; }
  .note { transform: none; }
  @keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
