/* =========================================================
   TextTimeTools — Shared Stylesheet
   Clean / Minimal / Tool-like. Brand blue #2563EB on white.
   ========================================================= */

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

:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --bg: #f8fafc;
  --surface: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3b82f6;
    --brand-dark: #60a5fa;
    --brand-soft: #172554;
    --ink: #f1f5f9;
    --ink-2: #e2e8f0;
    --muted: #94a3b8;
    --muted-2: #64748b;
    --line: #334155;
    --line-soft: #1e293b;
    --bg: #0b1220;
    --surface: #111a2e;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  color: var(--ink-2);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

/* Reading width for prose / headings / footer */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}
/* Wider stage for the interactive tool grid, answer cards and data tables */
.tool-section .container {
  max-width: 1080px;
}

/* ===== Header ===== */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: saturate(180%) blur(8px);
}
.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}
.logo-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: none;
}
.logo-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.logo span {
  color: var(--ink);
  font-weight: 500;
}
.nav a {
  margin-left: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}
.nav a:hover {
  color: var(--brand);
  text-decoration: none;
}
.nav a.active {
  color: var(--brand);
}

/* ===== Hero ===== */
.hero {
  background: var(--surface);
  padding: 52px 0 32px;
  text-align: center;
  border-bottom: 1px solid var(--line-soft);
}
.hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}
.hero p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 540px;
  margin: 0 auto;
}
.hero .eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

/* ===== Sections ===== */
.section {
  padding: 40px 0;
}
.section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.section > .container > p,
.section li {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.7;
}
.section ul {
  padding-left: 20px;
  margin: 12px 0;
}
.section li {
  margin-bottom: 8px;
}
.section strong {
  color: var(--ink-2);
}

/* ===== Tool Area ===== */
.tool-section {
  padding: 32px 0;
}
.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 28px;
  align-items: start;
}

/* ===== Input Panel ===== */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
}
.panel > label.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}
textarea.text-input {
  width: 100%;
  height: 280px;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-2);
  background: var(--bg);
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.text-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea.text-input::placeholder {
  color: var(--muted-2);
}
.hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 8px;
}

/* Input mode toggle */
.mode-toggle {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  margin-bottom: 14px;
}
.mode-toggle button {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.mode-toggle button.active {
  background: var(--brand);
  color: #fff;
}

/* Manual word-count input */
.wordcount-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink-2);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wordcount-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* ===== Controls ===== */
.controls {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
  margin-top: 20px;
}
.controls-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.control-group {
  flex: 1;
  min-width: 140px;
}
.control-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.control-group select,
.control-group input[type='number'] {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--ink-2);
  background: var(--bg);
  transition: border-color 0.15s;
}
.control-group select:focus,
.control-group input[type='number']:focus {
  outline: none;
  border-color: var(--brand);
}
.pause-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
}
.pause-toggle input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  cursor: pointer;
}
.pause-toggle label {
  font-size: 0.875rem;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}

/* ===== Results Panel ===== */
.results-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.result-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--brand);
}
.result-card.primary {
  border-left-color: var(--brand);
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--surface) 100%);
}
.result-card .label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.result-card .value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.result-card .value.small {
  font-size: 1.5rem;
}
.result-card .sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 4px;
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
}
.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
}
.data-table th {
  background: var(--bg);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}
.data-table td {
  font-size: 0.9375rem;
  color: var(--ink-2);
}
.data-table tr:last-child td {
  border-bottom: none;
}

/* ===== FAQ ===== */
.faq-item {
  background: var(--surface);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
}
.faq-item h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}
.faq-item p {
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ===== Related Tools ===== */
.related-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 10px;
}
.related-list li {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.related-list li a {
  font-weight: 600;
}

/* ===== Footer ===== */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 32px 0;
  margin-top: 48px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted-2);
}
.footer a {
  color: var(--muted);
  margin: 0 12px;
}
.footer a:hover {
  color: var(--brand);
}
.footer .disclaimer {
  margin-top: 10px;
  font-size: 0.75rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.footer .copyright {
  margin-top: 10px;
}

/* ===== Motion ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-up {
  animation: fadeUp 0.4s ease both;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Responsive ===== */
/* Tablet: collapse the two-column tool to a single column */
@media (max-width: 900px) {
  .tool-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }
  .tool-section {
    padding: 24px 0;
  }
  .section {
    padding: 28px 0;
  }
  .panel,
  .controls,
  .result-card,
  .faq-item,
  .answer-card {
    padding: 18px;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
  textarea.text-input {
    height: 220px;
    font-size: 1rem; /* prevent iOS zoom on focus */
  }
  .hero {
    padding: 32px 0 20px;
  }
  .hero h1 {
    font-size: 1.625rem;
  }
  .hero p {
    font-size: 0.975rem;
  }
  .section h2 {
    font-size: 1.25rem;
  }
  .result-card .value {
    font-size: 1.625rem;
  }
  .result-card .value.small {
    font-size: 1.375rem;
  }
  .controls-row {
    flex-direction: column;
    gap: 12px;
  }
  .control-group {
    min-width: 100%;
  }
  /* Header: logo + nav stay on one row a bit tighter, wrap if needed */
  .header {
    padding: 12px 0;
  }
  .header .container {
    gap: 8px;
  }
  .logo {
    font-size: 1.05rem;
    gap: 5px;
  }
  .logo-icon {
    width: 16px;
    height: 16px;
  }
  .nav a {
    margin-left: 14px;
    font-size: 0.8125rem;
  }
  /* Tables: horizontal scroll on small screens instead of squishing */
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  .footer a {
    display: inline-block;
    margin: 4px 10px;
  }
}

/* Tiny phones */
@media (max-width: 380px) {
  .hero h1 {
    font-size: 1.45rem;
  }
  .nav a {
    margin-left: 10px;
    font-size: 0.75rem;
  }
  .mode-toggle button {
    padding: 6px 12px;
  }
}
