/* Military Time Converter — design tokens (ShadCN-style, navy primary) */
:root {
  --background: #fafafa;
  --foreground: #18181b;
  --card: #ffffff;
  --border: #e4e4e7;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --primary: #1b3a5c;        /* deep navy — professional, not military-themed */
  --primary-hover: #2c5178;
  --primary-ring: rgba(27, 58, 92, 0.15);
  --error: #b91c1c;
  --star: #f59e0b;
  --star-off: #d4d4d8;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--background);
  color: var(--foreground);
  font-size: 16px;
  line-height: 1.65;
}
.container { max-width: 920px; margin: 0 auto; padding: 0 20px; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; justify-content: space-between; align-items: center; min-height: 60px; gap: 16px; }
.logo { font-size: 1.05rem; font-weight: 700; margin: 0; }
.logo a { color: var(--primary); text-decoration: none; }
.site-nav a { color: var(--muted-foreground); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--primary); }

/* Hero + converter */
.hero { padding: 40px 0 8px; text-align: center; }
.tagline { color: var(--muted-foreground); margin: 0 0 20px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.converter { max-width: 560px; margin: 0 auto; text-align: left; }

/* Chart page hero: converter left, quick-reference right */
.hero-grid { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: stretch; }
.hero-grid .converter { max-width: none; margin: 0; }
.hero-side { display: flex; flex-direction: column; gap: 18px; }
.hero-side .card { padding: 18px 20px; }
.hero-side .pop-card { flex: 1; }
.now-pair { display: flex; gap: 28px; margin-top: 8px; }
.now-item strong { display: block; font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.now-item span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.pop-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 0.95rem; text-decoration: none; }
.pop-row:last-child { border-bottom: none; }
.pop-row span:first-child { font-weight: 650; color: var(--primary); }
a.pop-row:hover span { color: var(--primary-hover); }
.input-label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 8px; }
#time-input {
  width: 100%;
  font-size: 1.75rem;
  font-family: var(--font);
  padding: 14px 16px;
  text-align: center;
  letter-spacing: 0.04em;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
}
#time-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.chip {
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.converter-output { margin-top: 16px; }
.result {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 2px;
  border-bottom: 1px dashed var(--border);
}
.result:last-of-type { border-bottom: none; }
.result-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); }
.result strong { font-size: 1.25rem; font-weight: 650; }
.result-hero strong { font-size: 1.9rem; color: var(--primary); }
.error-msg { color: var(--error); font-size: 0.95rem; margin: 12px 0 0; }

/* Sections */
section { padding: 30px 0 6px; }
h2 { font-size: 1.35rem; line-height: 1.3; margin: 0 0 14px; }
h3 { font-size: 1.05rem; margin: 20px 0 8px; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 22px; margin: 0 0 14px; }
li { margin-bottom: 6px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.95rem; }
thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); background: var(--muted); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(244, 244, 245, 0.5); }
td.time-mil { font-weight: 650; color: var(--primary); }

/* Link block cards */
.link-card {
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 14px 0;
}
.link-card p { margin: 0 0 8px; }
.link-card a { margin-right: 18px; }

/* Download card (compact chart-image preview) */
.download-card {
  display: flex;
  gap: 24px;
  align-items: center;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.download-card .download-thumb { flex-shrink: 0; display: block; cursor: zoom-in; }

/* Lightbox overlay (full-size image preview, click anywhere to close) */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  z-index: 1000;
  padding: 20px;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.download-card img {
  display: block;
  width: 240px;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.download-card .download-info p { margin: 0 0 10px; }
.download-card .download-info p:last-child { margin-bottom: 0; }

/* FAQ */
details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
}
summary { font-weight: 600; cursor: pointer; }
details[open] { padding-bottom: 16px; }
details p { margin: 10px 0 0; color: var(--foreground); }

/* Rating widget */
.rating { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; padding: 26px 0; }
.rating-label { font-size: 0.95rem; color: var(--muted-foreground); }
.stars button {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--star-off);
  cursor: pointer;
  padding: 0 2px;
}
.stars button.on { color: var(--star); }
.rating-note { font-size: 0.9rem; color: var(--muted-foreground); }

/* Ad slots (reserved positions — HIDDEN until AdSense code goes live.
   To unhide when pasting ad code: change display:none to display:flex
   (and drop the dashed border once a real ad renders). */
.ad-slot {
  display: none;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 90px;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  margin: 34px 0;
  background: var(--card);
}

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 48px; padding: 26px 0; color: var(--muted-foreground); font-size: 0.85rem; }
.site-footer a { color: var(--muted-foreground); margin-right: 16px; text-decoration: none; }
.site-footer a:hover { color: var(--primary); }

/* Answer hero on long-tail pages */
.answer-card { text-align: center; padding: 30px 24px; }
.answer-card .answer-big { font-size: 2.4rem; font-weight: 700; color: var(--primary); margin: 6px 0 4px; }
.answer-card .answer-sub { color: var(--muted-foreground); }
.answer-card .result { justify-content: center; gap: 10px; }

/* Print-only URL line (chart page: bottom of the printed sheet) */
.print-url { display: none; }

@page { margin: 12mm; }

/* Print */
@media print {
  .site-header, .site-nav, .ad-slot, .rating, .print-hide, .chips, .site-footer { display: none !important; }
  body { background: #fff; }
  .card { border: none; box-shadow: none; padding: 0; }
  table { border: 1px solid #999; }
  th, td { font-size: 11pt; }
  /* Chart print: ONLY the chart heading and the 24-hour table.
     Sized to fill ~90% of the sheet (buffer keeps it one page on Letter AND A4). */
  .page-chart main > section:not(.print-target) { display: none !important; }
  .page-chart .container { padding: 0; }
  .page-chart .print-target h2 { font-size: 20pt; margin: 0 0 6px; }
  .page-chart table { line-height: 1.25; }
  .page-chart th, .page-chart td { font-size: 13pt; padding: 5px 14px; }
  .print-url {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 9.5pt;
    color: #666;
  }
}

/* Tablet: hero grid stacks to one column */
@media (max-width: 800px) {
  .hero-grid { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 640px) {
  #time-input { font-size: 1.35rem; }
  h2 { font-size: 1.15rem; }
  th, td { padding: 8px 10px; font-size: 0.85rem; }
  .answer-card .answer-big { font-size: 1.8rem; }
  .result strong { font-size: 1.05rem; }
  .result-hero strong { font-size: 1.5rem; }
  .download-card { flex-direction: column; align-items: flex-start; gap: 14px; }
  .download-card img { width: 190px; }
}
