/* =====================================================================
   WRITING SPRINT TIMER — STYLES
   ---------------------------------------------------------------------
   All major colors live in the :root (light) and [data-theme="dark"]
   variable blocks below. To re-theme the tool, change the values there
   — nothing else needs to change.
   ===================================================================== */

:root {
  /* ---- Light theme (default) ---- */
  --color-cream: #faf6ef;
  --color-cream-deep: #f2ead9;
  --color-plum: #4a2c3f;
  --color-plum-deep: #3a2131;
  --color-olive: #6b7353;
  --color-olive-deep: #545b40;
  --color-dusty-rose: #c98c94;
  --color-gold: #b8925a;
  --color-ink: #2e2420;
  --color-ink-soft: #5a4f49;
  --color-white: #ffffff;
  --color-danger: #9a3f3f;
  --color-card-border: rgba(107, 115, 83, 0.25);

  /* ---- Typography ---- */
  --font-body: Georgia, 'Times New Roman', serif;
  --font-heading: 'Palatino Linotype', Georgia, 'Times New Roman', serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-mono: 'Courier New', Courier, monospace;

  /* ---- Spacing / sizing ---- */
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-soft: 0 4px 20px rgba(58, 33, 49, 0.12);
  --max-width: 760px;
}

[data-theme="dark"] {
  --color-cream: #221c22;
  --color-cream-deep: #2b2430;
  --color-plum: #e8d5df;
  --color-plum-deep: #f2e4ec;
  --color-olive: #a3ad8c;
  --color-olive-deep: #c3cdac;
  --color-dusty-rose: #d9a2aa;
  --color-gold: #d4ac78;
  --color-ink: #eee6e0;
  --color-ink-soft: #c9beb6;
  --color-white: #171317;
  --color-danger: #e59b9b;
  --color-card-border: rgba(163, 173, 140, 0.3);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--color-cream);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.page-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

h1, h2, h3 {
  font-family: var(--font-heading);
  color: var(--color-plum);
  margin: 0 0 12px;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--color-gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.is-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------------
   Breadcrumb
   --------------------------------------------------------------------- */
.breadcrumb {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin: 0 0 16px;
}

.breadcrumb a {
  color: var(--color-olive-deep);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--color-gold);
  text-decoration: underline;
}

/* ---------------------------------------------------------------------
   Settings bar
   --------------------------------------------------------------------- */
.settings-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  margin-bottom: 28px;
  background-color: var(--color-cream-deep);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-card-border);
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.settings-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--color-ink);
}

.settings-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

#volume-slider {
  width: 100px;
  cursor: pointer;
}

.btn-settings {
  background-color: var(--color-white);
  color: var(--color-plum-deep);
  border: 2px solid var(--color-olive);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-settings:hover {
  border-color: var(--color-gold);
}

.btn-settings[aria-pressed="true"] {
  background-color: var(--color-plum-deep);
  color: var(--color-white);
  border-color: var(--color-plum-deep);
}

/* ---------------------------------------------------------------------
   Header
   --------------------------------------------------------------------- */
.site-header {
  text-align: center;
  margin-bottom: 32px;
}

.site-header h1 {
  font-size: 2.5rem;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--color-ink-soft);
  max-width: 560px;
  margin: 0 auto;
}

/* ---------------------------------------------------------------------
   Status announcer
   --------------------------------------------------------------------- */
.status-announcer {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-olive-deep);
  min-height: 1.2em;
  text-align: center;
  margin: 0 0 16px;
}

/* ---------------------------------------------------------------------
   Field basics
   --------------------------------------------------------------------- */
.field-label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-plum);
  display: block;
  margin-bottom: 8px;
}

.optional-tag {
  font-weight: 400;
  color: var(--color-ink-soft);
  font-size: 0.85rem;
}

.field-group {
  margin-bottom: 20px;
}

.field-group label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--color-plum);
  display: block;
  margin-bottom: 8px;
}

.field-group input[type="text"],
.field-group input[type="number"],
.field-group textarea,
.duration-custom input {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-olive);
  background-color: var(--color-white);
  color: var(--color-ink);
}

.field-group textarea {
  resize: vertical;
  font-family: var(--font-body);
}

.field-error {
  color: var(--color-danger);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin: 8px 0 0;
}

/* ---------------------------------------------------------------------
   Setup panel — duration presets
   --------------------------------------------------------------------- */
.setup-panel {
  background-color: var(--color-cream-deep);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 32px;
}

.duration-block {
  margin-bottom: 28px;
}

.duration-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.duration-btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 10px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-olive);
  background-color: var(--color-white);
  color: var(--color-plum-deep);
  cursor: pointer;
}

.duration-btn:hover {
  border-color: var(--color-gold);
}

.duration-btn[aria-pressed="true"] {
  background-color: var(--color-plum-deep);
  border-color: var(--color-plum-deep);
  color: var(--color-white);
}

.duration-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.duration-custom label {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  color: var(--color-ink);
}

.duration-custom input {
  width: 140px;
}

.setup-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 24px;
}

.prompt-block {
  margin: 12px 0 28px;
  padding-top: 20px;
  border-top: 1px solid var(--color-card-border);
}

.prompt-preview {
  margin-top: 14px;
  background-color: var(--color-white);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.prompt-preview p {
  font-style: italic;
  color: var(--color-plum-deep);
  margin: 0 0 12px;
}

.start-button-wrap {
  text-align: center;
}

/* ---------------------------------------------------------------------
   Buttons (shared)
   --------------------------------------------------------------------- */
.btn {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background-color: var(--color-plum-deep);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-plum);
  color: var(--color-white);
}

.btn-secondary {
  background-color: var(--color-white);
  color: var(--color-plum-deep);
  border-color: var(--color-olive);
}

.btn-secondary:hover {
  border-color: var(--color-gold);
}

.btn-large {
  font-size: 1.15rem;
  padding: 18px 32px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--color-olive-deep);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 4px;
}

.btn-text-danger {
  background: none;
  border: none;
  color: var(--color-danger);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 4px;
}

/* ---------------------------------------------------------------------
   Timer panel
   --------------------------------------------------------------------- */
.timer-panel {
  background-color: var(--color-cream-deep);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: 40px;
  margin-bottom: 32px;
  text-align: center;
}

.timer-state-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-white);
  background-color: var(--color-dusty-rose);
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  margin: 0 0 20px;
}

.timer-state-label.is-paused {
  background-color: var(--color-gold);
}

.timer-clock {
  font-family: var(--font-mono);
  font-weight: bold;
  font-size: 5rem;
  color: var(--color-plum-deep);
  line-height: 1;
  margin-bottom: 24px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 14px;
  border-radius: 999px;
  background-color: var(--color-white);
  border: 1px solid var(--color-card-border);
  overflow: hidden;
  margin-bottom: 28px;
}

.progress-fill {
  height: 100%;
  background-color: var(--color-gold);
  width: 100%;
  transition: width 0.3s linear;
}

.timer-meta {
  margin: 0 0 20px;
  text-align: left;
  display: grid;
  gap: 8px;
}

.timer-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: 4px 0;
  border-bottom: 1px solid var(--color-card-border);
}

.timer-meta-row dt {
  color: var(--color-ink-soft);
  font-weight: 600;
}

.timer-meta-row dd {
  margin: 0;
  color: var(--color-ink);
  text-align: right;
}

.prompt-display {
  text-align: left;
  background-color: var(--color-white);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
}

.prompt-display p:last-child {
  font-style: italic;
  color: var(--color-plum-deep);
  margin: 0;
}

.timer-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

/* ---------------------------------------------------------------------
   Completion panel
   --------------------------------------------------------------------- */
.completion-panel {
  background-color: var(--color-cream-deep);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 32px;
}

.completion-intro {
  color: var(--color-ink-soft);
  margin-top: 0;
}

.completion-summary {
  background-color: var(--color-white);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.summary-headline {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--color-plum-deep);
  margin: 0 0 10px;
}

.summary-line {
  font-family: var(--font-ui);
  color: var(--color-olive-deep);
  font-weight: 600;
  margin: 0 0 14px;
}

.summary-details {
  margin: 0;
  display: grid;
  gap: 6px;
}

.completion-actions {
  text-align: center;
  margin-top: 8px;
}

/* ---------------------------------------------------------------------
   Stats / daily goal
   --------------------------------------------------------------------- */
.stats-section {
  margin-bottom: 40px;
}

.daily-goal-block {
  margin-bottom: 24px;
}

.daily-goal-display {
  background-color: var(--color-cream-deep);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.daily-goal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-ui);
  margin-bottom: 10px;
}

#daily-goal-numbers {
  font-weight: 700;
  color: var(--color-plum-deep);
}

.daily-goal-edit-actions {
  margin-top: 10px;
  display: flex;
  gap: 16px;
}

.daily-goal-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.daily-goal-input-row label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.95rem;
}

.daily-goal-input-row input {
  width: 120px;
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-olive);
  background-color: var(--color-white);
  color: var(--color-ink);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.stats-card {
  background-color: var(--color-white);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.stats-card h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  margin: 0 0 10px;
  color: var(--color-ink);
}

.stat-row strong {
  color: var(--color-plum-deep);
}

/* ---------------------------------------------------------------------
   Sprint history
   --------------------------------------------------------------------- */
.history-section {
  margin-bottom: 40px;
}

.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.history-item {
  background-color: var(--color-white);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-ui);
  margin-bottom: 10px;
}

.history-item-title {
  font-weight: 700;
  color: var(--color-plum-deep);
}

.history-item-date {
  color: var(--color-ink-soft);
  font-size: 0.9rem;
}

.history-item-details {
  font-family: var(--font-ui);
  font-size: 0.92rem;
  color: var(--color-ink);
  margin: 0 0 14px;
  line-height: 1.7;
}

.history-item-note {
  font-style: italic;
  color: var(--color-olive-deep);
  margin: 0 0 14px;
}

.history-item-actions {
  display: flex;
  gap: 10px;
}

.history-item-actions .btn {
  padding: 8px 16px;
  font-size: 0.9rem;
}

.favorites-empty {
  color: var(--color-ink-soft);
  font-style: italic;
}

/* ---------------------------------------------------------------------
   Promotional / CTA section
   --------------------------------------------------------------------- */
.promo-section {
  background-color: var(--color-plum);
  color: var(--color-cream);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}

[data-theme="dark"] .promo-section {
  background-color: #171317;
}

.promo-section h2 {
  color: var(--color-cream);
}

[data-theme="dark"] .promo-section h2 {
  color: var(--color-plum-deep);
}

.promo-section p {
  color: var(--color-cream-deep);
  max-width: 520px;
  margin: 0 auto 24px;
}

.promo-section .btn-primary {
  background-color: var(--color-gold);
  color: var(--color-plum-deep);
}

.promo-section .btn-primary:hover {
  background-color: #c9a066;
}

.promo-secondary-link {
  margin: 20px 0 0;
}

.promo-secondary-link a {
  color: var(--color-cream-deep);
  font-family: var(--font-ui);
  font-size: 0.95rem;
  text-decoration: underline;
}

.promo-secondary-link a:hover {
  color: var(--color-gold);
}

/* ---------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------- */
.site-footer {
  text-align: center;
  margin-top: 48px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--color-ink-soft);
}

.site-footer a {
  color: var(--color-ink-soft);
}

.site-footer a:hover {
  color: var(--color-gold);
}

/* ---------------------------------------------------------------------
   Focus mode
   --------------------------------------------------------------------- */
body.focus-mode .settings-bar,
body.focus-mode #intro-section,
body.focus-mode #stats-section,
body.focus-mode #history-section,
body.focus-mode #info-section,
body.focus-mode #related-tools-section,
body.focus-mode #promo-section,
body.focus-mode #site-footer,
body.focus-mode #breadcrumb,
body.focus-mode #setup-panel,
body.focus-mode #completion-panel {
  display: none !important;
}

body.focus-mode .page-wrap {
  padding-top: 8vh;
}

body.focus-mode .timer-panel {
  max-width: 640px;
  margin: 0 auto;
  padding: 56px;
}

body.focus-mode .timer-clock {
  font-size: 7rem;
}

.exit-focus-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 50;
}

/* ---------------------------------------------------------------------
   Modal (import choice)
   --------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(46, 36, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-box {
  background-color: var(--color-cream);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-soft);
}

.modal-box h2 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 720px) {
  .setup-fields {
    grid-template-columns: 1fr;
  }

  .duration-presets {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .site-header h1 {
    font-size: 2rem;
  }

  .timer-clock {
    font-size: 3.4rem;
  }

  body.focus-mode .timer-clock {
    font-size: 4.2rem;
  }

  .setup-panel,
  .timer-panel,
  .completion-panel,
  .promo-section {
    padding: 22px;
  }

  .timer-controls .btn,
  .completion-actions .btn {
    width: 100%;
  }

  .settings-bar {
    justify-content: center;
  }
}

/* ---------------------------------------------------------------------
   How-to-use / FAQ content section
   --------------------------------------------------------------------- */
.info-section {
  margin-bottom: 56px;
  border-top: 1px solid rgba(107, 115, 83, 0.3);
  padding-top: 24px;
}

.info-section h2 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

.info-section p {
  margin: 0 0 16px;
}

.faq-item {
  margin-bottom: 20px;
}

.faq-item:last-child {
  margin-bottom: 0;
}

.faq-item h3 {
  font-family: var(--font-heading);
  color: var(--color-plum);
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.faq-item p {
  margin: 0;
}

/* ---------------------------------------------------------------------
   Related tools (cross-linking)
   --------------------------------------------------------------------- */
.related-tools {
  margin: 40px 0 56px;
  text-align: center;
}

.related-tools h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.related-tools-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.related-tools-links a {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-olive-deep);
  text-decoration: none;
  border: 2px solid var(--color-olive);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  display: inline-block;
}

.related-tools-links a:hover {
  border-color: var(--color-gold);
  color: var(--color-gold);
}
