/* ==========================================================================
   Deedbell — Premium Letterpress & Book Page Design System
   ========================================================================== */

:root {
  /* Premium Letterpress Palette */
  --bg-paper: #F2EFE9;
  --bg-paper-subtle: #EBE7DF;
  --card-paper: #F9F7F3;

  --ink-primary: #1C1A18;
  --ink-secondary: #58534C;
  --ink-muted: #8C857B;

  --card-border: #D6CFC1;
  --border-subtle: #E2DBD0;

  /* Rich terracotta/vermilion accent */
  --accent-muted: #A84631;
  --accent-faint: rgba(168, 70, 49, 0.08);

  /* Typography Stack */
  --font-serif: "EB Garamond", Garamond, Baskerville, "Baskerville Old Face", "Hoefler Text", "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Layout */
  --max-ch: 62ch;
  --page-max-w: 720px;
  --card-min-h: 520px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-paper: #151413;
    --bg-paper-subtle: #1A1918;
    --card-paper: #191816;

    --ink-primary: #E8E5DD;
    --ink-secondary: #A39D94;
    --ink-muted: #6B665F;

    --card-border: #302E2A;
    --border-subtle: #262421;

    /* Muted copper accent */
    --accent-muted: #C46751;
    --accent-faint: rgba(196, 103, 81, 0.12);
  }
}

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

html {
  font-size: 19px;
  background-color: var(--bg-paper);
  color: var(--ink-primary);
  font-family: var(--font-serif);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-paper);
  /* Premium SVG noise texture for authentic paper grain */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

@media (prefers-color-scheme: dark) {
  body {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
  }
}

/* Typography Defaults */
p {
  margin-bottom: 1.5rem;
  max-width: var(--max-ch);
}

p:last-child {
  margin-bottom: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--ink-primary);
}

h1 {
  font-size: 2.2rem;
  line-height: 1.2;
  margin-bottom: 2.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.3;
  margin-top: 3.5rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.15rem;
  line-height: 1.4;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--accent-muted);
}

/* Focus Visibility */
:focus-visible {
  outline: 1.5px solid var(--accent-muted);
  outline-offset: 4px;
}

/* Masthead Header */
.site-header {
  width: 100%;
  max-width: var(--page-max-w);
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
  text-align: center;
}

.brand {
  display: block;
  font-size: 1.6rem;
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-primary);
  margin-bottom: 2rem;
}

.brand-dot {
  display: inline-block;
  opacity: 0.4;
  margin: 0 0.04em;
  transform: translateY(-0.1em);
}


.site-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-family: var(--font-serif);
}

.nav-link {
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.3s ease;
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
}

.nav-link:hover {
  color: var(--ink-primary);
}

.nav-link.is-active {
  color: var(--ink-primary);
  border-bottom: 1px solid var(--accent-muted);
}

/* Main Container */
.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--page-max-w);
  margin: 0 auto;
  padding: 1rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
}

/* View Sections */
.view-panel {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.view-panel.is-active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Deck View (Today's Card)
   ========================================================================== */
#view-card {
  flex: 1;
  flex-direction: column;
  align-items: center;
}

#view-card.is-active {
  display: flex;
}

.deck-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0.5rem 0 2rem;
}

.deck-stack {
  position: relative;
  width: 100%;
  max-width: 420px;
  min-height: var(--card-min-h);
  perspective: 1500px;
}

/* Subtle physical deck ghost card underneath */
.deck-ghost-card {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background-color: var(--card-paper);
  border: 1px solid var(--card-border);
  box-shadow:
    0 16px 40px -8px rgba(28, 26, 24, 0.08),
    0 4px 12px -2px rgba(28, 26, 24, 0.04);
  transform: translate(2.5px, 3px) rotate(0.45deg);
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}

@media (prefers-color-scheme: dark) {
  .deck-ghost-card {
    box-shadow:
      0 18px 45px -8px rgba(0, 0, 0, 0.55),
      0 4px 14px -2px rgba(0, 0, 0, 0.4);
  }
}

.deck-card {
  width: 100%;
  height: 100%;
  min-height: var(--card-min-h);
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.2, 0.9, 0.3, 1);
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
  border-radius: 4px;
}

.deck-card:hover {
  transform: translateY(-2px);
}

.deck-card.is-flipped {
  transform: rotateY(180deg);
}

.deck-card.is-flipped:hover {
  transform: rotateY(180deg) translateY(-2px);
}

.deck-card:focus-visible {
  outline: 2px solid var(--accent-muted);
  outline-offset: 8px;
}

.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: var(--card-paper);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  box-shadow:
    0 8px 24px -4px rgba(28, 26, 24, 0.06),
    0 2px 6px -1px rgba(28, 26, 24, 0.03),
    inset 0 0 0 4px var(--card-paper),
    inset 0 0 0 5px var(--card-border);
  padding: 3rem 3.25rem 2.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: box-shadow 0.3s ease;
}

.deck-card:hover .card-face {
  box-shadow:
    0 12px 32px -4px rgba(28, 26, 24, 0.09),
    0 4px 10px -2px rgba(28, 26, 24, 0.05),
    inset 0 0 0 4px var(--card-paper),
    inset 0 0 0 5px var(--card-border);
}

@media (prefers-color-scheme: dark) {
  .card-face {
    box-shadow:
      0 10px 28px -4px rgba(0, 0, 0, 0.4),
      0 2px 8px -1px rgba(0, 0, 0, 0.25),
      inset 0 0 0 4px var(--card-paper),
      inset 0 0 0 5px var(--card-border);
  }

  .deck-card:hover .card-face {
    box-shadow:
      0 14px 36px -4px rgba(0, 0, 0, 0.5),
      0 4px 12px -2px rgba(0, 0, 0, 0.35),
      inset 0 0 0 4px var(--card-paper),
      inset 0 0 0 5px var(--card-border);
  }
}

.card-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
}

.card-category {
  font-size: 0.96rem;
  letter-spacing: 0.025em;
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-style: normal;
  line-height: 1.4;
  display: inline-block;
}

.card-category .card-keyword {
  color: var(--ink-primary);
  font-weight: 600;
  letter-spacing: 0.015em;
}

.card-category .card-keyword-to {
  color: var(--accent-muted);
  font-weight: 600;
  letter-spacing: 0.015em;
}

.card-content-wrap {
  margin: auto 0;
  width: 100%;
}

/* Front: Imperative sentence, balanced & centered */
.card-front-text {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4.8vw, 2.3rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink-primary);
  text-align: center;
  max-width: 330px;
  margin: 0 auto;
}

/* Subtle deboss on light mode to mimic letterpress impression */
@media (prefers-color-scheme: light) {
  .card-front-text {
    text-shadow: 0.5px 0.5px 0px rgba(255, 255, 255, 0.7);
  }
}

/* Back: 2-3 sentences, intimate & centered */
.card-back {
  transform: rotateY(180deg);
}

.card-back-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.8;
  color: var(--ink-secondary);
  text-align: center;
  max-width: 310px;
  margin: 0 auto;
}

.card-back-text p {
  margin-bottom: 0.8rem;
}

.card-back-text a {
  color: var(--accent-muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease, color 0.2s ease;
  position: relative;
  z-index: 2;
}

.card-back-text a:hover {
  color: var(--ink-primary);
  opacity: 0.85;
}


/* Card Turn Affordance */
.card-footer-whisper {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  opacity: 0.75;
  transition: opacity 0.3s ease;
  user-select: none;
  pointer-events: none;
}

.deck-card:hover .card-footer-whisper {
  opacity: 1;
}

/* Mobile & Touch Affordance */
@media (hover: none) {
  .card-footer-whisper {
    opacity: 0.85;
  }
}

/* Simulated date indicator */
.simulated-bar {
  display: none;
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--accent-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}

.simulated-bar.is-visible {
  display: block;
  animation: fadeIn 0.4s ease;
}

.btn-inline-reset {
  background: none;
  border: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  border-bottom: 1px dotted var(--accent-muted);
  cursor: pointer;
  padding: 0 0.1rem 2px;
  margin-left: 0.5rem;
  transition: opacity 0.2s ease;
}

.btn-inline-reset:hover {
  opacity: 0.7;
}

/* ==========================================================================
   Editorial Content Pages
   ========================================================================== */
.prose {
  max-width: var(--max-ch);
  margin: 0 auto;
}

.prose p {
  font-size: 1.1rem;
  line-height: 1.75;
  color: var(--ink-secondary);
  margin-bottom: 1.6rem;
}

.prose p.lead {
  font-size: 1.3rem;
  line-height: 1.65;
  color: var(--ink-primary);
  margin-bottom: 2.5rem;
}

.prose hr {
  border: 0;
  text-align: center;
  margin: 3.5rem 0;
}

.prose hr::after {
  content: "⁂";
  font-size: 1.5rem;
  color: var(--ink-muted);
  letter-spacing: 0.5rem;
}

/* Lead statements across all pages (Today, Bells, Deeds) */
.lead-statement,
.prose p.lead-statement {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.6;
  color: var(--ink-secondary);
  text-align: center;
  max-width: 440px;
  margin: 0 auto 2.5rem;
  letter-spacing: 0;
}

.deck-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.deck-header .lead-statement {
  margin: 0 auto 0.45rem;
}

.deck-date-anchor {
  font-family: var(--font-serif);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
  margin: 0 auto;
  display: block;
  font-variant-numeric: oldstyle-nums;
  opacity: 0.8;
}



/* ==========================================================================
   Bells (Signal Setup & Artifact)
   ========================================================================== */
.glim-entry {
  margin-bottom: 2.25rem;
}

.glim-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.6rem;
}

.glim-title {
  font-size: 1.35rem;
  font-weight: 400;
  margin: 0;
  color: var(--ink-primary);
  font-family: var(--font-serif);
}

.glim-tag {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-muted);
  font-variant-numeric: oldstyle-nums;
  white-space: nowrap;
}

.glim-desc {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--ink-secondary);
  margin-bottom: 1.1rem;
}

.glim-action-wrap {
  margin-top: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.glim-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.6rem;
  background: transparent;
  color: var(--ink-primary);
  border: 1px solid var(--ink-primary);
  font-family: var(--font-serif);
  font-size: 0.92rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.glim-action-btn:hover {
  background: var(--ink-primary);
  color: var(--bg-paper);
}

.glim-hint {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-style: italic;
}


.glim-divider {
  border: 0;
  text-align: center;
  margin: 2.75rem 0 2.25rem;
}

.glim-divider::after {
  content: "⁂";
  font-size: 1.3rem;
  color: var(--ink-muted);
  letter-spacing: 0.4rem;
}

/* Editorial Waitlist Form */
.waitlist-box {
  margin-top: 1.5rem;
}

.waitlist-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 100%;
}

@media (min-width: 480px) {
  .waitlist-form {
    flex-direction: row;
    align-items: flex-end;
  }
}

.waitlist-input {
  flex: 1;
  padding: 0.5rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--ink-muted);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--ink-primary);
  border-radius: 0;
  transition: border-color 0.2s ease;
}

.waitlist-input::placeholder {
  color: var(--ink-muted);
  opacity: 0.7;
}

.waitlist-input:focus {
  outline: none;
  border-bottom: 1px solid var(--accent-muted);
}

.waitlist-button {
  padding: 0.6rem 1.8rem;
  background: transparent;
  color: var(--ink-primary);
  border: 1px solid var(--ink-primary);
  font-family: var(--font-serif);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 0;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.waitlist-button:hover {
  background: var(--ink-primary);
  color: var(--bg-paper);
}

.waitlist-feedback {
  font-size: 0.9rem;
  color: var(--accent-muted);
  margin-top: 1rem;
  display: none;
  font-style: italic;
}

.waitlist-feedback.is-visible {
  display: block;
}

/* Settings / Themes Page */
.settings-group {
  margin: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--border-subtle);
}

.settings-empty-warning {
  display: none;
  font-size: 0.92rem;
  color: var(--accent-muted);
  font-style: italic;
  text-align: center;
  margin-top: 1.75rem;
}

.settings-empty-warning.is-visible {
  display: block;
}


.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 1.6rem 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.settings-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

@media (prefers-color-scheme: dark) {
  .settings-item:hover {
    background-color: rgba(255, 255, 255, 0.025);
  }
}

.settings-label-wrap {
  flex: 1;
}

.settings-label {
  display: block;
  font-size: 1.25rem;
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--ink-primary);
  margin-bottom: 0.35rem;
  cursor: pointer;
}

.settings-desc {
  display: block;
  font-size: 0.96rem;
  color: var(--ink-secondary);
  line-height: 1.6;
}

/* Crisp Letterpress Checkbox */
.quiet-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border: 1px solid var(--ink-primary);
  background-color: transparent;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.quiet-checkbox:hover {
  border-color: var(--accent-muted);
  background-color: var(--accent-faint);
}

.quiet-checkbox:checked {
  background-color: var(--ink-primary);
  border-color: var(--ink-primary);
}

.quiet-checkbox:checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 6px;
  height: 11px;
  border: solid var(--card-paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.quiet-checkbox:focus-visible {
  outline: 2px solid var(--accent-muted);
  outline-offset: 4px;
}



/* Noscript notice */
.noscript-banner {
  padding: 1.5rem;
  margin-bottom: 2rem;
  border: 1px solid var(--accent-muted);
  background-color: var(--accent-faint);
  font-size: 0.95rem;
  color: var(--ink-primary);
  text-align: center;
}

/* Footer note */
.site-footer {
  width: 100%;
  max-width: var(--page-max-w);
  margin: auto auto 0;
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--ink-muted);
  letter-spacing: 0.15em;
}

/* ==========================================================================
   Card Top Emblem (Prominent, Centered Talisman / Type Seal)
   ========================================================================== */
.card-emblem-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 1.25rem;
  position: relative;
}

.card-emblem-header::before,
.card-emblem-header::after {
  content: "";
  flex: 1;
  height: 1px;
  background-color: var(--border-subtle);
}

.card-emblem-seal {
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 1rem;
  border-radius: 50%;
  border: 1px solid var(--card-border);
  background-color: var(--card-paper);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
  .card-emblem-seal {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(255, 255, 255, 0.05);
  }
}

.card-emblem-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--accent-muted);
  user-select: none;
}

.card-emblem-icon svg {
  width: 1.35rem;
  height: 1.35rem;
  display: block;
}

/* Settings Subgroup Section Titles */
.settings-section-title {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 3rem;
  margin-bottom: 0.5rem;
  color: var(--ink-muted);
  font-family: var(--font-serif);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
}

@media (max-width: 600px) {
  .card-face {
    padding: 2.5rem 1.8rem 2rem;
  }

  .card-emblem-seal {
    width: 2.35rem;
    height: 2.35rem;
    margin: 0 0.75rem;
  }

  .card-emblem-icon {
    font-size: 1.2rem;
  }
}