/* Compose mode and the publish sheet: the three lines with their syllable
   counts, the season picker, the actions, and the sheet's veil. */

/* centred between the top menu and the foot by auto margins on the first
   and last child, so a short window scrolls instead of tucking the
   heading under the menu */
.compose-wrap {
  height: 100%; display: flex; flex-direction: column; align-items: center;
  padding: 96px 6vw 48px; overflow-y: auto; scrollbar-width: none;
}
.compose-title {
  font-family: var(--font-label); font-weight: 300; font-size: var(--type-2);
  letter-spacing: 0.46em; text-transform: uppercase; color: var(--accent-quiet);
  margin-top: auto; margin-bottom: 46px; text-align: center; text-wrap: balance;
}
.composer { width: min(640px, 88vw); }
.composer .row {
  display: flex; align-items: center; gap: 22px;
  position: relative;
  border-bottom: 1px solid var(--ink-soft); padding: 8px 0;
  transition: border-color 0.7s var(--ease-breath);
}
.composer .row.ok { border-color: var(--accent); }
/* while a line is being written, a breath-paced accent rule grows from the
   centre beneath it (the same gesture as the season-word hairline) */
.composer .row::after {
  content: ""; position: absolute; left: 50%; bottom: -1px;
  width: 0; height: 1px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 65%, transparent), transparent);
  transition: width var(--dur-reveal) var(--ease-ink);
}
.composer .row:focus-within::after { width: 100%; }
.composer input {
  /* min-width 0 lets the field shrink, so the count stays inside the row on a 320px phone */
  flex: 1; min-width: 0; background: none; border: none; color: var(--text);
  font-family: var(--font-verse); font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 400; padding: 12px 0; letter-spacing: 0.01em;
}
.composer input::placeholder { color: var(--paper-faint); font-style: italic; }
/* the growing hairline is the field's focus; the transparent outline
   still shows in forced-colors modes */
.composer input:focus-visible { outline-color: transparent; }
.composer .count {
  font-family: var(--font-label); font-size: var(--type-2); font-weight: 300;
  letter-spacing: 0.1em; min-width: 56px; text-align: right;
  color: var(--paper-faint); transition: color var(--dur-hover) var(--ease-breath);
}
.composer .count.ok { color: var(--accent); }
.composer .count b { font-weight: 400; color: var(--paper); }

/* the count is an estimate, and says so, quietly and always */
.compose-note {
  margin-top: 18px; text-align: center;
  font-style: italic; font-size: 15px; color: var(--paper-faint);
}

.compose-actions {
  margin-top: 40px; margin-bottom: auto; display: flex; flex-direction: column; align-items: center; gap: 22px;
  min-height: 70px;
}
.settle-msg {
  font-style: italic; font-size: 17px; color: var(--paper-dim); height: 22px;
  transition: color var(--dur-state) var(--ease-breath); text-align: center;
}
.settle-msg.done { color: var(--accent); }
.action-row {
  display: flex; gap: 14px; opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity 0.8s var(--ease-breath), transform 0.8s var(--ease-breath);
}
.action-row.show { opacity: 1; transform: none; pointer-events: auto; }

/* season picker in compose and in the publish sheet: each kanji carries
   its name beneath, so the season reads as a choice, not an ornament */
.season-pick { display: flex; justify-content: center; gap: 8px; margin-bottom: 36px; }
.season-pick button {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 64px; min-height: 44px; padding: 6px 4px 10px;
  background: none; border: none; border-radius: 4px; cursor: pointer;
  color: var(--paper-faint);
  transition: color var(--dur-hover) var(--ease-breath);
}
.season-pick .pick-glyph {
  font-family: var(--font-glyph); font-size: 20px; line-height: 1;
  color: var(--paper-dim);
  transition: color var(--dur-hover) var(--ease-breath), transform var(--dur-hover) var(--ease-breath);
}
.season-pick .pick-name {
  font-family: var(--font-label); font-weight: 300; font-size: var(--type-1); line-height: 1;
  letter-spacing: 0.2em; padding-left: 0.2em;
}
/* the chosen season: lit in the accent, with the season word's hairline */
.season-pick button::after {
  content: ""; position: absolute; left: 50%; bottom: 0;
  width: 0; height: 1px; transform: translateX(-50%);
  background: var(--accent);
  transition: width 0.8s var(--ease-ink);
}
.season-pick button:hover, .season-pick button:hover .pick-glyph { color: var(--paper); }
.season-pick button.active, .season-pick button.active .pick-glyph { color: var(--accent); }
.season-pick button.active .pick-glyph { transform: scale(1.12); }
.season-pick button.active::after { width: 18px; }

/* ---- season chooser inside the publish sheet ---- */
.sheet-season-label {
  font-family: var(--font-label); font-weight: 300; font-size: var(--type-1);
  letter-spacing: 0.34em; text-transform: uppercase; color: var(--paper-dim);
  margin-bottom: 12px;
}
.season-pick.sheet-season { margin-bottom: 30px; }

/* ---- publish sheet ---- */
.sheet-bg {
  position: fixed; inset: 0; z-index: var(--z-sheet); background: var(--veil-sheet);
  backdrop-filter: blur(12px); opacity: 0; pointer-events: none;
  /* closed dialog leaves the tab order entirely (visibility flips late) */
  visibility: hidden;
  transition: opacity var(--dur-state) var(--ease-breath), visibility 0s linear 0.6s;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.sheet-bg.open {
  opacity: 1; pointer-events: auto; visibility: visible;
  transition: opacity var(--dur-state) var(--ease-breath);
}
.sheet {
  width: min(440px, 88vw); text-align: center;
  background: color-mix(in srgb, var(--ink-deep) 55%, transparent);
  border: 1px solid var(--ink-soft); border-radius: 6px;
  padding: 44px 36px;
  /* auto margins beat align-items:center when the sheet outgrows a short
     viewport, keeping its top edge scrollable instead of clipped */
  margin: auto;
  /* rises gently as the veil fades in */
  transform: translateY(12px);
  transition: transform var(--dur-state) var(--ease-breath);
}
.sheet-bg.open .sheet { transform: none; }
.sheet .spoem { margin-bottom: 32px; }
.sheet .spoem div { font-size: 1.3rem; line-height: 1.8; color: var(--text); }
.sheet h3 { font-family: var(--font-label); font-weight: 300; font-size: var(--type-1); letter-spacing: 0.4em; text-transform: uppercase; color: var(--accent); margin-bottom: 26px; }
.sheet input {
  width: 100%; background: none; border: none; border-bottom: 1px solid var(--ink-soft);
  color: var(--paper); font-family: var(--font-verse); font-size: 1.2rem; text-align: center;
  padding: 10px 0; margin-bottom: 30px;
  transition: border-color var(--dur-state) var(--ease-breath);
}
/* the underline lights as the field's focus; the transparent outline still
   shows in forced-colors modes */
.sheet input:focus-visible { outline-color: transparent; border-bottom-color: var(--accent); }
.sheet input::placeholder { color: var(--paper-faint); font-style: italic; }
.sheet .srow { display: flex; gap: 12px; justify-content: center; }
/* the name field's note (its limit, no emoji, a poem on its way), under its line */
.sheet-note {
  min-height: 22px; margin: -18px 0 18px;
  font-style: italic; font-size: 15px; color: var(--paper-dim);
}

@media (max-width: 820px) {
  .compose-wrap { padding: 16vh 7vw 48px; }
}

@media (max-width: 640px) {
  .compose-wrap { padding: 124px 6vw 40px; }
  .compose-title { margin-top: 0; margin-bottom: 28px; font-size: var(--type-1); letter-spacing: 0.28em; line-height: 1.6; }
  .season-pick { gap: 4px; margin-bottom: 24px; }
  .season-pick button { min-width: 58px; }
  .composer .row { gap: 12px; }
  .compose-actions { margin-top: 28px; }
  .action-row { flex-wrap: wrap; justify-content: center; }
}

/* the lines' and the name's placeholders fit, and the sheet's title keeps one line */
@media (max-width: 380px) {
  .composer .count { min-width: 44px; }
  .sheet h3 { letter-spacing: 0.22em; }
  .sheet input { font-size: 1.05rem; }
}

@media (max-height: 560px) {
  .compose-wrap { padding-top: 76px; padding-bottom: 24px; }
  .compose-title { margin-bottom: 18px; }
  .season-pick { margin-bottom: 18px; }
  .compose-actions { margin-top: 20px; }
}

@media (max-height: 480px) and (max-width: 900px) {
  .compose-wrap { padding-top: 60px; }
}

/* hairlines appear without growing; the actions and the sheet do not slide */
@media (prefers-reduced-motion: reduce) {
  .action-row { transform: none; transition: opacity 0.8s var(--ease-breath); }
  .composer .row::after { transition: none; }
  .season-pick button::after, .season-pick .pick-glyph { transition: none; }
  .sheet { transform: none; transition: none; }
}
