/* DateTimeHQ shared styles */
:root {
  --ink: #16213A;
  --ink-2: #34405A;
  --muted: #5A6478;
  --paper: #FFFFFF;
  --wash: #EEF1F5;
  --rule: #D5DBE4;
  --field: #B9C2D0;
  --red: #C8322B;
  --red-deep: #9E2620;
  --focus: #2F5BD3;
  --radius: 10px;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--wash);
}
img, svg { max-width: 100%; }
a { color: var(--focus); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .5rem 1rem; z-index: 10; }

/* Header */
.site-header { position: relative; background: var(--paper); border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem 1.5rem; min-height: 4rem; flex-wrap: wrap; padding-top: .5rem; padding-bottom: .5rem;
}
.brand {
  display: flex; align-items: center; gap: .6rem;
  color: var(--ink); text-decoration: none;
  font-weight: 750; font-stretch: 112%; font-size: 1.2rem; letter-spacing: -.01em;
}
.brand svg { width: 28px; height: 28px; flex: none; }
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 2px;
  text-decoration-color: var(--red); text-underline-offset: .35em;
}

/* "Tools" menu: a small popover listing only the tools that actually exist.
   Links are always in the HTML, just hidden until opened, so search engines
   crawl them normally regardless of open/closed state. Grows into grouped
   categories later once there are enough live tools to justify it. */
.menu-btn {
  display: flex; align-items: center; gap: .4rem;
  min-height: 44px; padding: .5rem .9rem;
  background: var(--paper); border: 1.5px solid var(--rule); border-radius: 8px;
  font: inherit; font-size: .975rem; font-weight: 650; color: var(--ink); cursor: pointer;
}
.menu-btn svg { width: 20px; height: 20px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; }
.menu-btn .chevron { width: 14px; height: 14px; transition: transform .15s ease; }
.menu-btn[aria-expanded="true"] { border-color: var(--ink-2); }
.menu-btn[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.menu-btn .hamburger { display: none; }
@media (max-width: 760px) {
  .site-nav { display: none; }
  .menu-btn .hamburger { display: block; }
  .menu-btn .chevron { display: none; }
}
.mobile-menu {
  position: absolute; z-index: 30;
  right: 1.25rem; left: auto; top: calc(100% + .5rem); min-width: 15rem;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 10px;
  box-shadow: 0 16px 28px -16px rgba(22, 33, 58, .3);
  padding: .4rem;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu a {
  display: flex; align-items: center; min-height: 44px;
  padding: .55rem .75rem; border-radius: 6px;
  font-size: .975rem; font-weight: 600; color: var(--ink); text-decoration: none;
}
.mobile-menu a:hover { background: var(--wash); }
.mobile-menu a[aria-current="page"] { color: var(--red); }
@media (max-width: 760px) {
  .mobile-menu { left: 1.25rem; right: 1.25rem; min-width: 0; }
}
.menu-cat + .menu-cat { margin-top: .4rem; padding-top: .55rem; border-top: 1px solid var(--rule); }
.menu-cat-label {
  margin: .2rem .75rem .1rem; padding: 0;
  font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted);
}

/* Page */
main { padding: 2.25rem 0 4rem; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; font-stretch: 88%; }
h2 { font-size: 1.5rem; font-weight: 750; font-stretch: 92%; }
h3 { font-size: 1.125rem; font-weight: 700; }
.lede { font-size: 1.2rem; color: var(--ink-2); max-width: 40rem; margin: 0 0 2rem; }
.crumbs { font-size: .95rem; color: var(--muted); margin: 0 0 1rem; }
.crumbs a { color: var(--muted); }

/* Tool panel */
.tool {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.75rem); margin-bottom: 3rem;
}
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem 1.25rem; }
.field label { display: block; font-weight: 650; margin-bottom: .35rem; }
.field .hint { display: block; font-size: .9rem; color: var(--muted); margin-top: .3rem; }
input[type="date"], input[type="number"], input[type="text"], input[type="time"], input[type="email"], select, textarea {
  width: 100%; min-height: 3rem;
  font: inherit; font-size: 1.05rem; color: var(--ink);
  padding: .6rem .75rem; background: var(--paper);
  border: 1.5px solid var(--field); border-radius: 8px;
}
textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.25rem; }
.btn {
  font: inherit; font-size: 1.05rem; font-weight: 700;
  min-height: 3rem; padding: .6rem 1.4rem;
  border-radius: 8px; border: 1.5px solid var(--ink);
  background: var(--ink); color: #fff; cursor: pointer;
}
.btn:hover { background: #0c1426; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-quiet { background: transparent; color: var(--ink-2); border-color: var(--rule); }
.btn-quiet:hover { background: var(--wash); color: var(--ink); }
.error { color: var(--red-deep); font-weight: 600; margin: 1rem 0 0; }
.error:empty { display: none; }

/* Contact form status message */
.form-status { margin: 1.25rem 0 0; padding: .85rem 1rem; border-radius: 8px; font-weight: 600; }
.form-status[hidden] { display: none; }
.form-status.ok { background: #E9F5EC; color: #1E6B3A; border: 1px solid #BEE3C7; }
.form-status.fail { background: #FBEAE9; color: var(--red-deep); border: 1px solid #F0C6C3; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Result area */
.result {
  display: grid; grid-template-columns: minmax(11rem, 14rem) 1fr; gap: 2rem; align-items: start;
  margin-top: 1.75rem; padding-top: 1.75rem; border-top: 1px solid var(--rule);
}
.result[hidden] { display: none; }
@media (max-width: 640px) {
  .result { grid-template-columns: 1fr; }
  .result .leaf { max-width: 15rem; }
}
.summary { font-size: 1.35rem; font-weight: 650; line-height: 1.35; margin: 0 0 .25rem; }
.summary-sub { color: var(--muted); margin: 0 0 1rem; }
.facts { display: grid; grid-template-columns: auto 1fr; margin: 0; }
.facts dt, .facts dd { padding: .55rem 0; border-bottom: 1px solid var(--wash); }
.facts dt { color: var(--muted); padding-right: 1.5rem; }
.facts dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* Tear-off calendar leaf: the site's signature element */
.leaf {
  position: relative; text-align: center;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  box-shadow: 0 5px 0 -1px var(--paper), 0 5px 0 0 var(--rule), 0 10px 0 -1px var(--paper), 0 10px 0 0 var(--rule);
  margin-bottom: 10px;
}
.leaf-head {
  position: relative;
  background: var(--red); color: #fff;
  font-weight: 700; font-size: 1rem;
  padding: 1rem 1rem .55rem;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.leaf-head::before, .leaf-head::after {
  content: ""; position: absolute; top: .38rem;
  width: .5rem; height: .5rem; border-radius: 50%;
  background: var(--wash); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .3);
}
.leaf-head::before { left: 26%; }
.leaf-head::after { right: 26%; }
.leaf-num {
  font-size: clamp(4.25rem, 15vw, 7rem); font-weight: 800; font-stretch: 70%;
  line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  padding: 1rem .5rem .2rem;
}
.leaf-foot { color: var(--ink-2); font-weight: 500; padding: 0 1rem 1.1rem; }

/* Two-date tools (date difference, days until/since, add-subtract) */
.field-row { display: flex; align-items: end; gap: 1rem; }
.field-row .field { flex: 1; }
.swap-btn {
  flex: none; width: 3rem; height: 3rem; margin-bottom: .05rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1.5px solid var(--field); border-radius: 8px; cursor: pointer;
}
.swap-btn:hover { border-color: var(--ink-2); }
.swap-btn svg { width: 20px; height: 20px; stroke: var(--ink-2); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 640px) {
  .field-row { flex-wrap: wrap; }
  .swap-btn { margin: 0 auto; }
}
.checkbox-field { display: flex; align-items: flex-start; gap: .6rem; margin-top: 1rem; }
.checkbox-field input { width: 1.2rem; height: 1.2rem; min-height: 0; margin-top: .2rem; accent-color: var(--ink); }
.checkbox-field label { font-weight: 550; cursor: pointer; }
.note { font-size: .95rem; color: var(--muted); margin: .5rem 0 0; }

.chip-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .75rem 0 0; }
.chip {
  font: inherit; font-size: .95rem; font-weight: 600; color: var(--ink-2);
  background: var(--wash); border: 1.5px solid transparent; border-radius: 999px;
  padding: .45rem 1rem; min-height: 44px; cursor: pointer;
}
.chip:hover { border-color: var(--field); color: var(--ink); }

.ref-table { width: 100%; border-collapse: collapse; margin: 1rem 0 0; font-size: .975rem; }
.ref-table th, .ref-table td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--rule); }
.ref-table th { color: var(--muted); font-weight: 650; }
.ref-table td:last-child, .ref-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.ext-link::after { content: "\2197"; display: inline-block; margin-left: .2em; font-size: .85em; }

/* Segmented toggle (add/subtract direction, unit choice) */
.seg { display: inline-flex; border: 1.5px solid var(--field); border-radius: 8px; overflow: hidden; }
.seg button {
  font: inherit; font-size: 1rem; font-weight: 650; color: var(--ink-2);
  background: var(--paper); border: 0; padding: 0 1.1rem; min-height: 3rem; cursor: pointer;
}
.seg button + button { border-left: 1.5px solid var(--field); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.amount-row { display: flex; align-items: end; gap: 1rem; flex-wrap: wrap; }
.amount-row .field { flex: 0 0 8rem; }
.amount-row .field.grow { flex: 1 1 12rem; }

/* Weekday-lookup result: a single highlighted line rather than the leaf+facts layout */
.weekday-result {
  margin-top: 1.75rem; padding-top: 1.75rem; border-top: 1px solid var(--rule);
}
.weekday-result[hidden] { display: none; }
.weekday-big { font-size: clamp(1.75rem, 5vw, 2.5rem); font-weight: 800; font-stretch: 85%; margin: 0 0 .35rem; letter-spacing: -.01em; }
.weekday-big .day { color: var(--red); }

/* Long-form content */
.prose { max-width: 42rem; }
.prose h2 { margin-top: 2.5rem; }
.prose p, .prose li { color: var(--ink-2); }
.faq { border-bottom: 1px solid var(--rule); padding: .9rem 0; }
.faq:first-of-type { border-top: 1px solid var(--rule); }
.faq summary { font-weight: 650; color: var(--ink); cursor: pointer; }
.faq p { margin: .6rem 0 0; }

/* Tool lists (home page and related tools) */
.tool-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.tool-list li { padding: .85rem 0; border-bottom: 1px solid var(--rule); }
.tool-list a, .tool-list .soon { display: block; font-weight: 650; font-size: 1.1rem; }
.tool-list a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: .25em; }
.tool-list a:hover { text-decoration-color: var(--red); }
.tool-list .soon { color: var(--muted); }
.tool-list .soon em { white-space: nowrap; font-style: normal; font-weight: 500; font-size: .85rem; margin-left: .4rem; }
.tool-list .desc { display: block; color: var(--muted); font-size: .975rem; }
.related { margin-top: 3rem; max-width: 42rem; }

/* Home */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 3.5rem; align-items: start; margin-bottom: 3.5rem; }
.hero h1 { font-size: clamp(2.25rem, 6vw, 3.6rem); line-height: 1.05; letter-spacing: -.025em; }
.hero .lede { margin-bottom: 1.75rem; }
.quick { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.25rem; max-width: 38rem; }
.quick label { display: block; font-weight: 650; margin-bottom: .5rem; }
.quick-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.quick-row input { flex: 1 1 12rem; width: auto; }
.quick p { margin: .75rem 0 0; font-size: .95rem; }
.today .leaf-num { font-size: clamp(5rem, 14vw, 8rem); }
.now { display: grid; grid-template-columns: auto 1fr; margin: 1.25rem 0 0; font-size: .975rem; }
.now dt, .now dd { padding: .5rem 0; border-bottom: 1px solid var(--rule); }
.now dt { color: var(--muted); padding-right: 1rem; }
.now dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; }
  .today { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1.25rem; align-items: center; }
  .today .leaf { margin-bottom: 0; }
  .today .leaf-num { font-size: 3.75rem; padding-top: .6rem; }
  .today .leaf-head { font-size: .85rem; padding: .8rem .5rem .45rem; }
  .today .leaf-foot { font-size: .85rem; padding-bottom: .7rem; }
  .now { margin: 0; font-size: .875rem; }
  .now dt { white-space: nowrap; padding-right: .5rem; }
}
@media (max-width: 480px) {
  .site-nav ul { gap: .25rem 1rem; font-size: .95rem; }
}

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 3.5rem; }
.tile {
  display: flex; flex-direction: column; gap: .35rem;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.25rem 1.4rem; color: var(--ink); text-decoration: none;
}
.tile:hover { border-color: var(--ink-2); color: var(--ink); }
.tile svg { width: 26px; height: 26px; stroke: var(--red); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; margin-bottom: .35rem; }
.tile strong { font-size: 1.2rem; font-weight: 750; }
.tile span { color: var(--muted); font-size: .975rem; line-height: 1.5; }
.tile-main { grid-row: span 2; padding: 1.75rem; }
.tile-main strong { font-size: 1.6rem; letter-spacing: -.015em; }
.tile-main span { font-size: 1.05rem; }
.tile-main .eg { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--wash); color: var(--ink-2); }
@media (max-width: 860px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tile-main { grid-column: span 2; grid-row: auto; } }
@media (max-width: 520px) { .tiles { grid-template-columns: 1fr; } .tile-main { grid-column: auto; } }

.section-h { font-size: clamp(1.5rem, 3vw, 1.85rem); margin-bottom: 1rem; }
.qa h3 { margin: 1.75rem 0 .4rem; font-size: 1.2rem; }
.qa p { margin: 0; }
.next { color: var(--ink-2); }
.updated { font-size: .95rem; color: var(--muted); margin-top: 2rem; }

/* Footer */
.site-footer { background: var(--paper); border-top: 1px solid var(--rule); padding: 2rem 0; color: var(--muted); font-size: .95rem; }
.site-footer a { color: var(--muted); }
.footer-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1.5rem; }
.footer-row p { margin: 0; }
@media (max-width: 560px) {
  .footer-row { flex-direction: column; align-items: flex-start; gap: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.tool + .tool { margin-top: 1.25rem; }
.tool-h { margin: 0 0 .75rem; font-size: 1.15rem; }
#wd-result { margin-top: 1rem; }
#wd-result .summary { font-size: 1.1rem; }

/* Wordmark: DateTime in the logo red, HQ in black */
.brand-name .dt { color: var(--red); }
.brand-name .hq { color: #111; }

/* Guides link in the header, before the Tools button */
.nav-right { gap: .75rem; }
.nav-link {
  display: flex; align-items: center; min-height: 44px; padding: .5rem .9rem;
  font-size: .975rem; font-weight: 650; color: var(--ink); text-decoration: none;
  border-radius: 8px; border: 1.5px solid transparent;
}
.nav-link:hover { background: var(--wash); }
.nav-link[aria-current="page"] {
  text-decoration: underline; text-decoration-thickness: 2px;
  text-decoration-color: var(--red); text-underline-offset: .35em;
}
@media (max-width: 480px) {
  .brand { font-size: 1.05rem; gap: .45rem; }
  .brand svg { width: 24px; height: 24px; }
  .nav-right { gap: .15rem; }
  .nav-link { padding: .5rem .6rem; }
  .menu-btn { padding: .5rem .7rem; }
}
@media (max-width: 380px) {
  .menu-btn .hamburger { display: none; }
  .brand { font-size: 1rem; }
}
