/* ── Tokens ──────────────────────────────────────────────────────── */
:root {
  --bg:      #0f0e0c;
  --surface: #1a1815;
  --text:    #e2ddd5;
  --muted:   #7a7268;
  --accent:  #c8b89a;
  --w:       1100px;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────── */
header {
  text-align: center;
  padding: 40px 24px 0;
}

.site-title {
  display: inline-block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: clamp(22px, 4vw, 36px);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
  padding-right: 0.32em; /* compensate for letter-spacing on last char */
}

.site-rule {
  width: 32px;
  height: 1px;
  background: var(--muted);
  margin: 18px auto 16px;
  opacity: 0.5;
}

nav {
  display: flex;
  justify-content: center;
  gap: 40px;
  padding-bottom: 40px;
}

nav a {
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

nav a:hover  { color: var(--text); }
nav a.active { color: var(--accent); }

/* ── Main wrapper ────────────────────────────────────────────────── */
main {
  max-width: var(--w);
  margin: 0 auto;
  padding: 0 24px 72px;
}

/* ── (removed: page-index single-screen layout, today page, postcard metadata) ── */

/* ── Archive page ────────────────────────────────────────────────── */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 24px;
}

.archive-card {
  cursor: pointer;
  display: block;
}

.archive-thumb {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.22s, transform 0.22s;
}

.archive-card:hover .archive-thumb {
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.6);
  transform: translateY(-3px);
}

/* ── About page ──────────────────────────────────────────────────── */
.page-about {
  max-width: 600px;
}

.about-text {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.75;
  color: var(--text);
}

.about-text p {
  margin-bottom: 1.4em;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-section {
  margin-top: 2.5em;
}

.about-heading {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1em;
}

/* ── Create page ────────────────────────────────────────────────── */
/* Mobile sticky bar — hidden on desktop */
.create-sticky-bar {
  display: none;
}

/* Action buttons row (below postcard) */
.create-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  max-width: 440px;
}

.page-create {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 48px;
  align-items: start;
  max-width: var(--w);
}

@media (max-width: 900px) {
  .page-create {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-bottom: 72px;
  }

  .create-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid rgba(122, 114, 104, 0.3);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
  }

  .create-sticky-bar .create-btn-generate,
  .create-sticky-bar .create-btn-download,
  .create-sticky-bar .create-btn-reset {
    flex: 1 1 0;
    min-width: 0;
    margin-top: 0;
    text-align: center;
    padding: 12px 4px;
    font-size: 12px;
  }

  /* Hide the inline actions row on mobile (moved to sticky bar) */
  .create-actions {
    display: none;
  }
}

.create-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  margin-top: 16px;
}

.create-label:first-child {
  margin-top: 0;
}

.create-select,
.create-input {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.15s;
}

.create-select:focus,
.create-input:focus {
  border-color: var(--accent);
}

.create-place-row {
  display: flex;
  gap: 8px;
}

.create-place-select {
  flex: 1;
  min-width: 0;
}

.create-custom-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.create-custom-btn:hover {
  border-color: var(--accent);
}

.create-custom-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

/* Segmented radio controls */
.create-segmented {
  display: flex;
  gap: 0;
  border: 1px solid var(--muted);
  border-radius: 4px;
  overflow: hidden;
}

.create-segmented label {
  flex: 1;
  cursor: pointer;
}

.create-segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.create-segmented span {
  display: block;
  text-align: center;
  padding: 7px 4px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
  border-right: 1px solid var(--muted);
  transition: background 0.15s, color 0.15s;
}

.create-segmented label:last-child span {
  border-right: none;
}

.create-segmented input:checked + span {
  background: var(--accent);
  color: var(--bg);
}

/* Inline collapsed details (season override, precise time) */
.create-inline-details {
  margin-top: 6px;
}

.create-inline-details summary {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.create-inline-details summary:hover {
  color: var(--text);
}

.create-inline-details > select,
.create-inline-details > div {
  margin-top: 6px;
}

/* Buttons */
.create-btn-generate {
  display: block;
  width: 100%;
  margin-top: 24px;
  padding: 12px;
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.create-btn-generate:hover {
  opacity: 0.85;
}

.create-btn-generate:disabled {
  opacity: 0.5;
  cursor: wait;
}

.create-actions .create-btn-generate,
.create-actions .create-btn-download {
  flex: 1 1 0;
  min-width: 0;
  margin-top: 0;
  text-align: center;
  white-space: nowrap;
  padding: 12px;
  box-sizing: border-box;
}

.create-btn-reset {
  padding: 12px 18px;
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.1em;
  box-sizing: border-box;
  text-transform: uppercase;
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--muted);
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.create-btn-reset:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Result panel */
.create-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  min-height: 200px;
  justify-content: center;
}

.create-placeholder {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  aspect-ratio: 8 / 11;
  width: 100%;
  max-width: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.create-loading {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.create-postcard-img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.55));
}

.create-btn-download {
  display: inline-block;
  padding: 10px 24px;
  font-size: 13px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.create-btn-download:hover {
  background: var(--accent);
  color: var(--bg);
}

/* Custom place fields */
.create-custom-fields {
  padding: 12px 0 4px;
}

/* Season indicator */
.create-season-indicator {
  display: block;
  margin-top: 4px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 12px;
  color: var(--muted);
}

/* Sub-options (indented dependent controls) */
.create-sub-options {
  padding-left: 16px;
  border-left: 2px solid var(--muted);
  border-left-color: rgba(122, 114, 104, 0.25);
  margin-top: 16px;
  margin-bottom: 4px;
}

#landOptions {
  margin-top: 24px;
}

#customPlotFields {
  margin-top: 14px;
}

/* Modified indicator — accent left border on changed controls */
.create-select.create-modified,
.create-input.create-modified,
.create-time-input.create-modified {
  border-left: 3px solid var(--accent);
}

/* Overridden indicator — dim controls that are superseded by an override */
.create-overridden {
  opacity: 0.4;
  pointer-events: none;
}

/* Section-level collapsible details (Foreground, Background) */
.create-section-details {
  margin-top: 24px;
  border-top: 1px solid var(--muted);
  border-top-color: rgba(122, 114, 104, 0.3);
  padding-top: 16px;
}

.create-section-details summary {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.create-section-details summary:hover {
  color: var(--text);
}

/* Text overlay details */
.create-text-overlay {
  margin-top: 24px;
  border-top: 1px solid var(--muted);
  border-top-color: rgba(122, 114, 104, 0.3);
  padding-top: 16px;
}

.create-text-overlay summary {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
}

.create-text-overlay summary:hover {
  color: var(--text);
}

.create-text-overlay-inner {
  padding-top: 8px;
}

/* Custom font picker */
.create-font-picker {
  position: relative;
}

.create-font-selected {
  display: block;
  width: 100%;
  padding: 8px 12px;
  padding-right: 32px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
  position: relative;
}

.create-font-selected::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.15s;
}

.create-font-picker.open .create-font-selected::after {
  transform: translateY(-25%) rotate(-135deg);
}

.create-font-selected:hover,
.create-font-picker.open .create-font-selected {
  border-color: var(--accent);
}

.create-font-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 10;
  margin-top: 2px;
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 4px;
  overflow: hidden;
}

.create-font-picker.open .create-font-dropdown {
  display: block;
}

.create-font-option {
  padding: 8px 12px;
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}

.create-font-option:hover {
  background: rgba(200, 184, 154, 0.12);
}

.create-font-option.active {
  color: var(--accent);
}

/* Textarea */
.create-textarea {
  resize: vertical;
  min-height: 60px;
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.5;
}

/* Color row */
.create-color-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Color swatch */
.create-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.create-swatch:hover {
  border-color: var(--muted);
}

.create-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* RGB sliders + preview circle */
.create-rgb-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.create-rgb-sliders {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.create-rgb-slider {
  display: flex;
  align-items: center;
  gap: 8px;
}

.create-rgb-label {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  width: 36px;
}

.create-color-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--muted);
  flex-shrink: 0;
}

.create-range-r { accent-color: #c0392b; }
.create-range-g { accent-color: #3a6b4a; }
.create-range-b { accent-color: #2c3e6b; }

/* Range slider */
.create-range {
  flex: 1;
  accent-color: var(--accent);
}

/* Rotation row */
.create-rotation-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.create-rotation-value {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--muted);
  min-width: 40px;
  text-align: right;
}

/* Time row */
.create-time-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.create-input-narrow {
  width: 80px;
}

.create-time-input {
  width: 56px;
  padding: 8px 4px;
  font-size: 14px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 4px;
  outline: none;
  text-align: center;
}

.create-time-input:focus {
  border-color: var(--accent);
}

.create-time-sep {
  font-size: 16px;
  color: var(--muted);
}

/* Inline hint (inside label) */
.create-hint-inline {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
  opacity: 0.7;
}


/* ── Error ───────────────────────────────────────────────────────── */
.error {
  display: none;
  padding: 12px 16px;
  border: 1px solid rgba(200, 80, 80, 0.3);
  background: rgba(200, 80, 80, 0.06);
  border-radius: 6px;
  font-size: 13px;
  color: #c87070;
}

/* ── Footer ──────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 32px 24px 40px;
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  opacity: 0.6;
}

/* ── Lightbox ────────────────────────────────────────────────────── */
.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 32px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.lb-overlay.lb-open {
  opacity: 1;
  pointer-events: auto;
}

.lb-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-height: 100%;
}

.lb-img {
  display: block;
  max-height: 85vh;
  max-width: min(90vw, calc(85vh * 8 / 11));
  width: auto;
  height: auto;
  box-shadow: 0 32px 96px rgba(0, 0, 0, 0.65);
}

.lb-meta {
  text-align: center;
}

.lb-rows {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.9;
  text-align: center;
}
