/* UtilHub — shared styles. Light theme, system fonts, no external assets. */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fb;
  --text: #1a2332;
  --text-muted: #5b6b82;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --max-width: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand span { color: var(--accent); }

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.main-nav a {
  display: block;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}
.main-nav a:hover { background: var(--bg-soft); color: var(--text); }
.main-nav a.active { background: var(--accent); color: #fff; }

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.hero h1 { font-size: 2rem; margin: 0 0 0.4rem; letter-spacing: -0.02em; }
.hero p { color: var(--text-muted); margin: 0 auto; max-width: 640px; }

.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  margin: 1.25rem 0;
}

h2.section-title { font-size: 1.25rem; margin: 0 0 1rem; }

/* ---------- Ad slots ---------- */
.ad-slot {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  background: #f8fafc;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
  position: relative;
}
.ad-slot span {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #94a3b8;
}
.ad-slot.leaderboard { min-height: 110px; }

/* ---------- Forms / controls ---------- */
label { display: block; font-weight: 600; margin: 0.75rem 0 0.3rem; font-size: 0.95rem; }

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.4rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: #eef2f7; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }

.result-box {
  margin-top: 1.25rem;
  padding: 1.25rem;
  background: var(--bg-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 1.15rem;
}
.result-box strong { font-size: 1.5rem; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.error { color: #dc2626; font-weight: 600; }

/* ---------- World clock ---------- */
.big-clock { text-align: center; padding: 1rem 0; }
.big-clock .time {
  font-size: clamp(3rem, 12vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.big-clock .date { color: var(--text-muted); font-size: 1.1rem; margin-top: 0.25rem; }
.big-clock .tz { color: var(--text-muted); font-size: 0.9rem; }

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}
.city-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.city-card .city-name { font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: 0.45rem; }
.city-card .city-time { font-size: 1.65rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 0.2rem; }
.city-card .city-date { color: var(--text-muted); font-size: 0.85rem; }
.day-night { font-size: 1.1rem; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tab {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-muted);
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Timer ---------- */
.timer-display {
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin: 0.5rem 0 1rem;
}
.laps { list-style: none; padding: 0; margin: 1rem 0 0; max-height: 220px; overflow-y: auto; }
.laps li {
  display: flex; justify-content: space-between;
  padding: 0.45rem 0.2rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.timer-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 760px) { .timer-grid { grid-template-columns: 1fr 1fr; } }

/* ---------- Barcode ---------- */
.code-output {
  margin-top: 1.25rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
  overflow-x: auto;
}
.code-output svg, .code-output canvas, .code-output img { max-width: 100%; height: auto; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.92rem; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }
.copyright { color: var(--text-muted); font-size: 0.88rem; }

/* ---------- Prose pages ---------- */
.prose { max-width: 760px; }
.prose h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.prose h2 { font-size: 1.25rem; margin-top: 1.75rem; }
.prose p, .prose li { color: #334155; }

@media (max-width: 640px) {
  .header-inner { justify-content: center; text-align: center; }
  .main-nav ul { justify-content: center; }
  .hero h1 { font-size: 1.6rem; }
}

/* ---------- Tool directory (RapidTables-style hub) ---------- */
.tool-dir { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1rem; }
@media (min-width: 760px) { .tool-dir { grid-template-columns: repeat(3, 1fr); } }
.tool-cat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  background: #fff;
  box-shadow: var(--card-shadow);
}
.tool-cat h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.tool-cat ul { list-style: none; margin: 0; padding: 0; }
.tool-cat li { margin: 0.35rem 0; }
.tool-cat a { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 0.96rem; }
.tool-cat a:hover { text-decoration: underline; }
.tool-cat p { margin: 0 0 0.6rem; color: var(--text-muted); font-size: 0.88rem; }

/* ---------- Cross-links between related tools ---------- */
.cross-links { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-top: 1.5rem; }
@media (min-width: 640px) { .cross-links { grid-template-columns: repeat(2, 1fr); } }
.cross-links a {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  color: var(--text);
  background: var(--bg-soft);
  font-weight: 700;
}
.cross-links a:hover { border-color: var(--accent); }
.cross-links small { display: block; font-weight: 400; color: var(--text-muted); margin-top: 0.15rem; }

/* ---------- v2 additions ---------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff;
  padding: 0.6rem 1rem; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

.nav-toggle {
  display: none;
  background: none; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1.3rem; line-height: 1;
  padding: 0.45rem 0.7rem; cursor: pointer; color: var(--text);
}

.breadcrumbs { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.tool-hero { text-align: left; padding: 0.75rem 0; }
.tool-hero p { margin: 0; max-width: 720px; }

.section-desc { color: var(--text-muted); margin: -0.5rem 0 1rem; }

.tool-grid {
  display: grid; grid-template-columns: 1fr; gap: 0.9rem; margin: 1rem 0 2rem;
}
@media (min-width: 640px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .tool-grid { grid-template-columns: repeat(3, 1fr); } }

.tool-card {
  display: block; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; box-shadow: var(--card-shadow);
  padding: 1.15rem 1.25rem; text-decoration: none; color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tool-icon { font-size: 1.7rem; display: block; margin-bottom: 0.4rem; }
.tool-name { display: block; font-weight: 800; font-size: 1.05rem; }
.tool-desc { display: block; color: var(--text-muted); font-size: 0.92rem; margin-top: 0.25rem; }
.tool-card-soon { opacity: 0.75; }
.tool-card-soon:hover { border-color: var(--border); transform: none; }
.soon-badge {
  display: inline-block; margin-top: 0.5rem; font-size: 0.75rem; font-weight: 700;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 999px;
  padding: 0.15rem 0.6rem; color: var(--text-muted);
}

.faq-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  margin: 0.6rem 0; background: #fff; overflow: hidden;
}
.faq-item summary {
  cursor: pointer; font-weight: 700; padding: 0.9rem 1.1rem; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "+ "; color: var(--accent); font-weight: 800; }
.faq-item[open] summary::before { content: "– "; }
.faq-item summary:hover { color: var(--accent); }
.faq-item p { padding: 0 1.1rem 1rem; margin: 0; color: #334155; }

.example-list { columns: 1; }
@media (min-width: 640px) { .example-list { columns: 2; } }
.example-list li { break-inside: avoid; margin-bottom: 0.3rem; }

textarea {
  width: 100%; padding: 0.65rem 0.8rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1rem; font-family: inherit; background: #fff; color: var(--text);
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.hero-buttons {
  display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center;
  margin-top: 1.5rem;
}
.hero-buttons .btn { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.link-more { display: inline-block; margin-top: 1rem; font-weight: 600; }
.benefit-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem; margin-top: 1rem;
}
.benefit-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 1.25rem;
}
.benefit-card h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }
.benefit-card p { color: var(--muted); font-size: 0.95rem; margin: 0; }
.about-section p { max-width: 65ch; }
input[type="date"] {
  width: 100%; padding: 0.65rem 0.8rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1rem; font-family: inherit; background: #fff; color: var(--text);
}
input[type="date"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.footer-grid {
  display: grid; grid-template-columns: 1fr; gap: 1.5rem;
  align-items: start; justify-content: stretch;
}
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-grid h4 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin: 0.35rem 0; }
.footer-grid nav a { color: var(--text-muted); text-decoration: none; font-size: 0.92rem; }
.footer-grid nav a:hover { color: var(--accent); text-decoration: underline; }
.footer-brand p { color: var(--text-muted); font-size: 0.92rem; margin: 0.5rem 0 0; max-width: 280px; }
.footer-bottom { border-top: 1px solid var(--border); }
.footer-bottom .copyright { max-width: var(--max-width); margin: 0 auto; padding: 1rem; }

@media (max-width: 760px) {
  .header-inner { flex-wrap: nowrap; }
  .nav-toggle { display: block; }
  .main-nav { display: none; width: 100%; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; gap: 0; }
  .main-nav a { padding: 0.75rem 0.5rem; border-top: 1px solid var(--border); border-radius: 0; }
}
