/* Date Tools — shared stylesheet. System fonts only, no external files. */
:root {
  --text: #1e293b;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 14px 32px rgba(79, 70, 229, .08);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, .08), 0 20px 48px rgba(79, 70, 229, .13);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(60rem 20rem at 50% -6rem, rgba(99, 102, 241, .16), rgba(99, 102, 241, 0) 70%),
    var(--bg);
}

::selection { background: #c7d2fe; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, select:focus-visible {
  outline: 3px solid rgba(79, 70, 229, .5);
  outline-offset: 2px;
}

/* Header and navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 10px rgba(15, 23, 42, .05);
}
.header-inner { max-width: 880px; margin: 0 auto; padding: 0.9rem 1.25rem 0.8rem; }
.brand {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-decoration: none;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.brand small {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}
.site-nav { display: flex; flex-wrap: wrap; gap: 0.35rem 0.4rem; margin-top: 0.7rem; }
.site-nav a {
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease;
  white-space: nowrap;
}
.site-nav a:hover { background: var(--accent-soft); color: var(--accent); }
.site-nav a[aria-current="page"] { background: var(--accent); color: #fff; }

/* Layout */
main { max-width: 880px; margin: 0 auto; padding: 2rem 1.25rem 3.5rem; }
h1 {
  font-size: 2.35rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0.5rem 0 0.85rem;
}
h1::after {
  content: "";
  display: block;
  width: 4rem;
  height: 0.32rem;
  margin-top: 0.85rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
h2 {
  font-size: 1.4rem;
  letter-spacing: -0.015em;
  margin-top: 2.75rem;
  margin-bottom: 0.6rem;
}
h2::after {
  content: "";
  display: block;
  width: 2.25rem;
  height: 0.22rem;
  margin-top: 0.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.55;
}
h3 { font-size: 1.08rem; margin-bottom: 0.25rem; }
.lede { font-size: 1.14rem; color: var(--muted); max-width: 62ch; }

/* Tool card */
.tool {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.9rem;
  margin: 1.75rem 0;
  box-shadow: var(--shadow-md);
}
.tool::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), #06b6d4);
}
.form-row { margin-bottom: 1.1rem; }
label { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 0.4rem; }
input[type="date"], input[type="number"], select {
  width: 100%;
  padding: 0.8rem 0.9rem;
  font-size: 1.05rem;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="date"]:focus, input[type="number"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .16);
}
button, .btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 0.85rem 1.8rem;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
button:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(79, 70, 229, .42);
  filter: brightness(1.06);
  color: #fff;
}
button:active, .btn:active { transform: translateY(0); }
.preset-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.1rem; }
.preset-row button {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #e0e7ff;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: none;
}
.preset-row button:hover { background: #e0e7ff; color: var(--accent-hover); box-shadow: none; }

/* Results — the showpiece: a bold gradient panel */
.result {
  background: linear-gradient(135deg, #4f46e5, #7c3aed 60%, #9333ea);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 1.6rem 1.75rem;
  margin-top: 1.5rem;
  box-shadow: 0 14px 34px rgba(79, 70, 229, .38);
}
.result p { margin: 0.45rem 0; color: #e0e7ff; }
.result strong { color: #fff; }
.result .big {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.result .error { color: #fecaca; font-weight: 600; }
.result .note { font-size: 0.92rem; color: #c7d2fe; }
.result:has(.error) {
  background: #fef2f2;
  border: 1px solid #fecaca;
  box-shadow: none;
}
.result:has(.error) p { color: #7f1d1d; }
.result:has(.error) .error { color: #b91c1c; }

/* Index tool cards */
.tool-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin: 2rem 0; }
.tool-card {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem 1.5rem 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--card-accent, linear-gradient(90deg, var(--accent), var(--accent-2)));
}
.tool-card::after {
  position: absolute;
  top: 0.55rem;
  right: 1.1rem;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  color: rgba(79, 70, 229, .09);
  pointer-events: none;
}
.tool-card:nth-child(1) { --card-accent: linear-gradient(90deg, #4f46e5, #7c3aed); }
.tool-card:nth-child(1)::after { content: "01"; }
.tool-card:nth-child(2) { --card-accent: linear-gradient(90deg, #0891b2, #06b6d4); }
.tool-card:nth-child(2)::after { content: "02"; }
.tool-card:nth-child(3) { --card-accent: linear-gradient(90deg, #d97706, #f59e0b); }
.tool-card:nth-child(3)::after { content: "03"; }
.tool-card:nth-child(4) { --card-accent: linear-gradient(90deg, #059669, #10b981); }
.tool-card:nth-child(4)::after { content: "04"; }
.tool-card:nth-child(5) { --card-accent: linear-gradient(90deg, #db2777, #f472b6); }
.tool-card:nth-child(5)::after { content: "05"; }
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}
.tool-card h2 { font-size: 1.2rem; margin: 0 0 0.4rem; }
.tool-card h2::after { display: none; }
.tool-card h2 a { color: var(--text); text-decoration: none; }
.tool-card h2 a:hover { color: var(--accent); }
.tool-card p { margin: 0.4rem 0 1rem; color: var(--muted); }

/* Footer */
.site-footer { background: #0f172a; border-top: none; }
.footer-inner { max-width: 880px; margin: 0 auto; padding: 2rem 1.25rem; font-size: 0.92rem; color: #94a3b8; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; margin-bottom: 0.75rem; }
.footer-inner a { color: #c7d2fe; text-decoration: none; font-weight: 600; }
.footer-inner a:hover { color: #fff; }

@media (min-width: 640px) {
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .tool-grid .tool-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .form-inline { display: flex; gap: 1rem; }
  .form-inline .form-row { flex: 1; }
}

@media (max-width: 639px) {
  h1 { font-size: 1.85rem; }
  main { padding: 1.5rem 1rem 3rem; }
  .header-inner { padding: 0.8rem 1rem 0.7rem; }
  .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.3rem;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .tool { padding: 1.4rem 1.25rem; border-radius: 18px; }
  .result { padding: 1.35rem 1.25rem; }
  .result .big { font-size: 1.6rem; }
  button, .btn { width: 100%; text-align: center; }
  .preset-row button { width: auto; }
  .tool-card { padding: 1.35rem 1.25rem 1.45rem; }
}
