/* Age Calculator — responsive stylesheet */
:root {
  color-scheme: light;
  --page-bg: #f5f7fb;
  --surface: #ffffff;
  --text: #182230;
  --muted: #667085;
  --border: #e3e8ef;
  --primary: #3157d5;
  --primary-hover: #2446b8;
  --primary-soft: #eef2ff;
  --success-soft: #f0fdf4;
  --danger: #b42318;
  --shadow: 0 12px 34px rgba(25, 42, 70, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

.container {
  width: min(100% - 40px, 920px);
  margin-inline: auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner,
.brand,
.site-header nav,
.footer-inner {
  display: flex;
  align-items: center;
}

.header-inner,
.footer-inner {
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

.brand {
  gap: 10px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 750;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.site-header nav {
  gap: 24px;
}

.site-header nav a {
  color: #475467;
  font-size: 0.94rem;
  font-weight: 600;
}

.main-content {
  padding-top: 26px;
  padding-bottom: 64px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
}

.breadcrumbs a {
  color: #475467;
}

.page-heading {
  max-width: 700px;
  margin: 38px auto 28px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.045em;
}

.page-heading > p:last-child {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.calculator-card {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(22px, 5vw, 36px);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.heading-icon {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  place-items: center;
  border-radius: 15px;
  background: var(--primary-soft);
  font-size: 1.45rem;
}

.card-heading h2 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
}

.card-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

#age-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.94rem;
  font-weight: 700;
}

.input-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

input[type="date"] {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 11px 13px;
  border: 1px solid #cfd7e3;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input[type="date"]:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(49, 87, 213, 0.15);
}

.primary-button {
  flex: 0 0 auto;
  min-height: 50px;
  padding: 11px 20px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover {
  background: var(--primary-hover);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:focus-visible,
.text-button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(49, 87, 213, 0.35);
  outline-offset: 3px;
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.error-message {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

.error-message:empty {
  display: none;
}

.result-panel {
  margin-top: 26px;
  padding: 22px;
  border: 1px solid #d9e3ff;
  border-radius: 15px;
  background: linear-gradient(145deg, #f7f9ff, #fff);
}

.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-label {
  color: #475467;
  font-size: 0.94rem;
  font-weight: 700;
}

.text-button {
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-weight: 700;
}

.text-button:hover {
  background: var(--primary-soft);
}

.age-summary {
  margin: 5px 0 20px;
  color: var(--primary);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
}

.age-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.age-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 15px 8px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
}

.age-unit strong {
  font-size: 1.5rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.age-unit span {
  color: var(--muted);
  font-size: 0.86rem;
}

.result-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.87rem;
}

.info-section {
  max-width: 760px;
  margin: 42px auto 0;
}

.info-section h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.info-section > p {
  margin: 0;
  color: #475467;
  line-height: 1.85;
}

.faq-section {
  margin-top: 42px;
}

.faq-section details {
  padding: 17px 0;
  border-bottom: 1px solid var(--border);
}

.faq-section details:first-of-type {
  border-top: 1px solid var(--border);
}

.faq-section summary {
  position: relative;
  padding-right: 28px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.5;
  list-style: none;
}

.faq-section summary::-webkit-details-marker {
  display: none;
}

.faq-section summary::after {
  position: absolute;
  top: 0;
  right: 2px;
  color: var(--primary);
  content: "+";
  font-size: 1.25rem;
  line-height: 1.3;
}

.faq-section details[open] summary::after {
  content: "−";
}

.faq-section details p {
  margin: 12px 0 0;
  color: #475467;
  line-height: 1.8;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.footer-inner {
  min-height: 68px;
  color: var(--muted);
  font-size: 0.86rem;
}

.footer-inner p {
  margin: 0;
}

@media (max-width: 600px) {
  .container {
    width: min(100% - 28px, 920px);
  }

  .header-inner {
    min-height: 64px;
  }

  .site-header nav {
    gap: 14px;
  }

  .site-header nav a {
    font-size: 0.88rem;
  }

  .main-content {
    padding-top: 20px;
    padding-bottom: 44px;
  }

  .page-heading {
    margin-top: 30px;
  }

  .page-heading > p:last-child {
    font-size: 0.98rem;
  }

  .calculator-card {
    padding: 21px 17px;
    border-radius: 16px;
  }

  .input-row {
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .result-panel {
    padding: 16px;
  }

  .age-breakdown {
    gap: 8px;
  }

  .age-unit {
    padding: 13px 5px;
  }

  .age-unit strong {
    font-size: 1.3rem;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding-block: 15px;
  }
}

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