:root {
  color-scheme: light;
  --background: #f8f1eb;
  --paper: #fffaf6;
  --soft-paper: #f7ede9;
  --ink: #392732;
  --muted: #67525e;
  --accent: #633b55;
  --accent-hover: #4e2c44;
  --line: #e6d7d7;
  --control-line: #947886;
  --focus: #794369;
  --danger: #8b3444;
  --radius: 1.6rem;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}

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

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 10% 5%, #fffbf4, transparent 39rem),
    radial-gradient(ellipse at 94% 23%, #efe0e6, transparent 46rem),
    var(--background);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
}

h1, h2, p { margin: 0; }

h1, h2 {
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.04;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

h1 { font-size: clamp(2.8rem, 6vw, 5rem); }
h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); }

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.68; }

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

[tabindex='-1']:focus { outline: none; }

.site-header-inner, .main {
  width: min(100% - 4.5rem, 71rem);
  margin-inline: auto;
}

.site-header-inner {
  min-height: 5.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #dfcfd2;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  font: 500 clamp(1.18rem, 3vw, 1.55rem)/1.1 var(--serif);
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  flex: 0 0 2.42rem;
  width: 2.42rem;
  height: 2.42rem;
  border: 1px solid #d3aebb;
  border-radius: 50%;
  background: #a45f76;
  color: #fff7ed;
}

.brand-mark::before {
  position: absolute;
  inset: 0.65rem 0.65rem auto;
  height: 0.57rem;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 1rem 1rem 0 0;
  content: '';
}

.brand-mark::after {
  position: absolute;
  inset: 1.28rem 0.47rem auto;
  height: 1px;
  background: currentColor;
  box-shadow: 0 0.22rem 0 -0.08rem #ffded8;
  content: '';
}

.main { margin-block: clamp(1.65rem, 5vw, 3.6rem) 4rem; }

.panel, .status-panel {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 0.8rem 2.8rem #5123350d;
}

.status-panel { padding: clamp(1.65rem, 6vw, 4rem); }
.status-panel h1 { font-size: clamp(2.15rem, 5vw, 3.25rem); }
.status-panel p { margin-top: 0.75rem; color: var(--muted); }
.status-panel .button { margin-top: 1.25rem; }

.welcome, .thought { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.welcome {
  min-height: 34rem;
  background: linear-gradient(147deg, #fffdf7, #fcf4ef 66%, #faeee9);
}

.welcome-copy, .thought-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  padding: clamp(2rem, 6vw, 5.25rem);
}

.welcome-copy h1 { max-width: 12ch; }

.intro {
  max-width: 34ch;
  margin-top: 1rem;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.8vw, 1.17rem);
}

.landscape {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background:
    radial-gradient(ellipse at 58% 30%, #f9e5ba, transparent 55%),
    linear-gradient(140deg, #eac8b3, #bd8d88 53%, #5f5064);
}

.landscape::after {
  position: absolute;
  inset: 0.9rem;
  border: 1px solid #fffbf493;
  border-radius: calc(var(--radius) - 0.54rem);
  content: '';
  pointer-events: none;
}

.welcome-landscape {
  margin: 0.72rem 0.72rem 0.72rem 0;
  border-radius: calc(var(--radius) - 0.55rem);
}

.landscape img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.welcome-landscape img { object-position: 54% 50%; }
.landscape img:not(.loaded) { visibility: hidden; }

.login-form {
  display: grid;
  width: min(100%, 23rem);
  gap: 0.65rem;
  margin-top: 1.8rem;
}

.login-form label {
  font-size: 0.94rem;
  font-weight: 650;
}

.login-form .button { margin-top: 0.25rem; }
.login-form .field-hint { margin-bottom: 0.22rem; }

.field-hint, .access-note { color: var(--muted); font-size: 0.9rem; }
.access-note { margin-top: 0.75rem; max-width: 37ch; }

.welcome-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  width: min(100%, 23rem);
  margin-top: 1.35rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.welcome-links:not(:has(a:not([hidden]))) { display: none; }

.welcome-link {
  color: var(--accent);
  font-size: 0.91rem;
  font-weight: 600;
  text-underline-offset: 0.2em;
}

input, textarea {
  width: 100%;
  min-height: 3.15rem;
  border: 1px solid var(--control-line);
  border-radius: 0.65rem;
  padding: 0.68rem 0.9rem;
  background: #fffcfa;
  color: var(--ink);
}

textarea {
  display: block;
  min-height: 7rem;
  resize: vertical;
}

textarea::placeholder { color: #74616b; }

.button, .quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 0.68rem;
  font: 650 0.94rem/1.35 var(--sans);
  text-align: center;
  text-decoration: none;
}

.login-form .button { min-height: 3.2rem; }
.button { background: var(--accent); color: #fffbf7; }
.button:where(:hover, :active) { background: var(--accent-hover); }

.quiet-button {
  border-color: var(--control-line);
  background: transparent;
  color: var(--accent);
}

.quiet-button:where(:hover, :active) {
  border-color: var(--accent);
  background: #f1e5ea;
}

.feedback { color: var(--muted); }
.feedback[data-tone='error'] { color: var(--danger); }
.feedback[data-tone='success'] { color: var(--accent); }
.global-feedback { margin-top: 1.2rem; }

.thought {
  grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.04fr);
  min-height: 31rem;
}

.thought-copy { padding-block: clamp(2.75rem, 6vw, 4.6rem); }
.thought-copy h1 { font-size: clamp(2.45rem, 5vw, 4rem); }
.thought-copy .button { margin-top: 1.35rem; }

.date-label {
  margin-bottom: 1.35rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 650;
}

.thought-text {
  max-width: 38ch;
  margin-top: 1.25rem;
  color: #503d48;
  font: 500 clamp(1.22rem, 2.1vw, 1.48rem)/1.5 var(--serif);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.thought-text:empty { margin-top: 0; }

.signature {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.45rem;
  font: italic 1.05rem/1.4 var(--serif);
  color: var(--accent);
}

.signature::before {
  width: 1.45rem;
  height: 1px;
  background: #a97991;
  content: '';
}

.thought-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}
.thought-actions .button { margin-top: 0; }

.daily-options { display: grid; gap: 0.9rem; margin-top: 1.2rem; }

.daily-disclosure {
  --disclosure-gap: clamp(1.05rem, 3.8vw, 2.4rem);
  scroll-margin-top: 1.25rem;
}

.reflection { background: #f7e9ee; }
.reply { background: #fffbf7; }

.disclosure-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(0.65rem, 2vw, 1.15rem);
  min-height: 6.15rem;
  padding: 1.15rem var(--disclosure-gap);
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}

.disclosure-summary::-webkit-details-marker { display: none; }
.disclosure-summary:focus-visible { outline-offset: -5px; }
.disclosure-summary:hover { background: #8b526b09; }

.disclosure-copy { min-width: 0; }

.disclosure-title {
  display: block;
  color: var(--ink);
  font: 500 clamp(1.48rem, 3vw, 1.98rem)/1.1 var(--serif);
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.disclosure-description {
  display: block;
  margin-top: 0.32rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.48;
}

.disclosure-mark, .disclosure-toggle {
  position: relative;
  display: block;
  border-radius: 50%;
  color: var(--accent);
}

.disclosure-mark {
  width: 2.9rem;
  height: 2.9rem;
  background: #eed9e4;
}

.reply .disclosure-mark { background: #f2e2d8; }

.disclosure-mark::before, .disclosure-mark::after,
.disclosure-toggle::before, .disclosure-toggle::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: '';
}

.disclosure-mark::before {
  width: 1.18rem;
  height: 0.9rem;
  border: 1.5px solid currentColor;
  border-radius: 0.3rem;
  transform: translate(-50%, -53%);
}

.disclosure-mark::after {
  width: 0.34rem;
  height: 0.34rem;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  background: #eed9e4;
  transform: translate(-100%, 60%) skewY(-34deg);
}

.reply .disclosure-mark::before { border-radius: 0.2rem; }
.reply .disclosure-mark::after {
  width: 0.49rem;
  height: 0.49rem;
  border: 0;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  background: transparent;
  transform: translate(-50%, -76%) rotate(45deg);
}

.disclosure-toggle {
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid #cdb2c0;
}

.disclosure-toggle::before, .disclosure-toggle::after {
  width: 0.69rem;
  height: 1.5px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.disclosure-toggle::after { transform: translate(-50%, -50%) rotate(90deg); }
.daily-disclosure[open] .disclosure-toggle::after { display: none; }

.disclosure-body {
  padding: clamp(1rem, 3vw, 1.5rem) var(--disclosure-gap) clamp(1.2rem, 4vw, 2.2rem);
  border-top: 1px solid #ddc9d2;
}

.reply-form { max-width: 44rem; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin-top: 0.8rem;
}

.counter { font-size: 0.875rem; color: var(--muted); }
.reply-form .feedback { margin-top: 0.75rem; }

.inbox {
  max-width: 56rem;
  margin-inline: auto;
  padding: clamp(1.65rem, 4.5vw, 3.35rem);
}

.inbox-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem 1rem; flex-wrap: wrap; }
.inbox-top h1 { font-size: clamp(2.65rem, 5vw, 4rem); }
.inbox-top p { margin-top: 0.65rem; color: var(--muted); }
.inbox > .feedback { margin-top: 1.6rem; }
.inbox > .button { margin-top: 1.5rem; }

.invitation {
  margin-top: 1.65rem;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--soft-paper);
}

.invitation h2 { margin-bottom: 0.5rem; font-size: 1.6rem; }
.invitation .login-form { margin-top: 1rem; }

.reply-list {
  display: grid;
  gap: 0.8rem;
  margin: 1.65rem 0 0;
  padding: 0;
  list-style: none;
}

.reply-list:empty { margin: 0; }

.reply-item {
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: var(--soft-paper);
}

.reply-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  color: var(--muted);
  font-size: 0.875rem;
}

.reply-item-meta time { color: var(--accent); font-weight: 650; }
.reply-item p { margin: 0.6rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 49rem) {
  .site-header-inner { min-height: 4.45rem; }
  .main, .site-header-inner { width: min(100% - 2rem, 38rem); }
  .welcome, .thought { grid-template-columns: 1fr; min-height: auto; }
  .welcome-copy, .thought-copy { padding: clamp(1.55rem, 7vw, 2.8rem); }
  .welcome-copy h1 { font-size: clamp(2.65rem, 10.5vw, 4.2rem); }
  .welcome-landscape { margin: 0 0.65rem 0.65rem; min-height: clamp(9.75rem, 39vw, 15rem); }
  .thought-landscape { grid-row: 1; min-height: clamp(11rem, 40vw, 17.5rem); }
  .landscape::after { inset: 0.65rem; }
  .thought-text { margin-top: 0.95rem; }
  .date-label { margin-bottom: 1rem; }
  .thought-actions { margin-top: 1.35rem; }
}

@media (max-width: 24rem) {
  .main, .site-header-inner { width: calc(100% - 1.25rem); }
  .brand { gap: 0.55rem; }
  .quiet-button { padding-inline: 0.7rem; }
  .disclosure-summary { min-height: 5.5rem; }
  .disclosure-mark { width: 2.45rem; height: 2.45rem; }
  .disclosure-toggle { width: 1.65rem; height: 1.65rem; }
}
