/* PlanLo shared design — base components.
 * Extracted from hub styles.css: reset, paper notebook shell, cards, form fields, buttons,
 * toast, footer. Additive only — hub / travel / split keep their own styles.css untouched. */

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

html,
body {
  margin: 0;
  padding: 0;
}

/* Author display rules must not override the hidden attribute */
[hidden] {
  display: none !important;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff8ea 0%, transparent 50%),
    linear-gradient(180deg, #d9c9a8 0%, #cbb897 100%);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}

/* —— Paper notebook shell —— */

.notebook {
  display: flex;
  max-width: 480px;
  margin: 1.2rem auto;
  background: var(--paper);
  border-radius: 6px 14px 14px 6px;
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45);
  min-height: calc(100vh - 2.4rem);
  min-height: calc(100dvh - 2.4rem);
  position: relative;
}

.notebook::before {
  content: "";
  position: absolute;
  inset: 0 0 0 18px;
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 27px,
    rgba(196, 163, 90, 0.07) 28px
  );
  pointer-events: none;
  border-radius: inherit;
}

.binding {
  width: 18px;
  flex: 0 0 18px;
  background:
    repeating-linear-gradient(
      180deg,
      #7a2d26 0 10px,
      #8e342a 10px 22px,
      #5e211c 22px 24px
    );
  border-radius: 6px 0 0 6px;
  box-shadow: inset -4px 0 8px rgba(0, 0, 0, 0.18);
}

.page {
  flex: 1;
  padding: 1.6rem 1.35rem 1.1rem;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* —— Masthead —— */

.masthead {
  text-align: center;
  margin-bottom: 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px dashed var(--rule-strong);
}

.brand-kana {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: var(--seal);
  font-weight: 600;
}

.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.tagline {
  margin: 0.45rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* —— Cards —— */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 1rem 1.05rem 1.1rem;
  box-shadow: 0 4px 14px rgba(70, 52, 24, 0.05);
}

.card-quiet {
  background: transparent;
  box-shadow: none;
  border-style: dashed;
}

.card-title {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding-bottom: 0.45rem;
  border-bottom: 1px dashed var(--rule);
}

.status-badge {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--rule);
}

/* —— Forms —— */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.72rem;
}

.field-static {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink);
  padding: 0.55rem 0.7rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.field input,
.field select {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 0.62rem 0.75rem;
  min-height: 44px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(181, 74, 60, 0.55);
  box-shadow: 0 0 0 3px rgba(181, 74, 60, 0.12);
}

/* —— Buttons —— */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  min-height: 44px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: linear-gradient(180deg, var(--seal) 0%, var(--seal-deep) 100%);
  color: #fffdf8;
  box-shadow: 0 4px 12px rgba(142, 52, 42, 0.22);
  border-color: var(--seal-deep);
}

.btn-secondary {
  background: var(--paper);
  color: var(--ink-soft);
  border-color: var(--rule-strong);
  width: 100%;
}

.btn-secondary:hover {
  background: var(--paper-deep);
}

.btn-ghost {
  background: transparent;
  color: var(--seal);
  border-color: var(--rule-strong);
  min-height: 36px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.btn-ghost:hover {
  background: rgba(181, 74, 60, 0.06);
}

/* —— Toast —— */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(12px);
  background: var(--ink);
  color: #fbf6ec;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(44, 38, 29, 0.28);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: calc(100vw - 2rem);
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* —— Footer —— */

.foot {
  margin-top: auto;
  padding-top: 1.5rem;
  text-align: center;
}

.foot p {
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.foot p + p {
  margin-top: 0.2rem;
}

.foot a {
  color: var(--seal);
  text-decoration: none;
  border-bottom: 1px dotted rgba(181, 74, 60, 0.45);
}

.foot a:hover {
  border-bottom-style: solid;
}

.back-link {
  display: inline-block;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--seal);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.back-link:hover {
  text-decoration: underline;
}

/* —— Dark theme (only when a page opts in with html[data-theme="dark"]) —— */

html[data-theme="dark"] body {
  background: #100e0c;
  color: var(--ink);
}

html[data-theme="dark"] .notebook,
html[data-theme="dark"] .page,
html[data-theme="dark"] .card,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--card);
  color: var(--ink);
  border-color: var(--rule-strong);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] .card-title,
html[data-theme="dark"] a {
  color: var(--ink);
}

html[data-theme="dark"] .status-badge {
  background: var(--paper-deep);
  color: var(--ink-soft);
}

html[data-theme="dark"] .btn-secondary {
  background: var(--paper);
  color: var(--ink-soft);
}

html[data-theme="dark"] .btn-secondary:hover {
  background: var(--paper-deep);
}

/* —— Responsive shell —— */

@media (min-width: 640px) {
  .notebook {
    max-width: 560px;
    margin: 1.6rem auto;
  }
  .binding {
    width: 22px;
    flex-basis: 22px;
  }
  .notebook::before {
    inset: 0 0 0 22px;
  }
}

@media (max-width: 380px) {
  .page {
    padding-left: 1.1rem;
    padding-right: 1.05rem;
  }
  .masthead h1 {
    font-size: 1.55rem;
  }
}
