/* ================================
   Pediatric Interventional Pulmonology – Article Styles
   Responsive, readable, and print-friendly
   ================================ */

/* ----- CSS Reset / Base ----- */
:root {
  --bg: #ffffff;
  --text: #222222;
  --muted: #444444;
  --muter: #666666;
  --border: #dddddd;
  --accent: #0073e6;
  --heading: #111111;

  /* Typography scale */
  --fz-base: 16px;
  --lh: 1.6;
  --fz-h1: 2rem;   /* 32px on desktop */
  --fz-h2: 1.6rem; /* 25.6px on desktop */
  --fz-h3: 1.25rem;/* 20px on desktop */
  --fz-p: 1.0625rem; /* 17px */
}

html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: inherit; }

html, body {
  height: 100%;
  overflow-x: hidden; /* prevent accidental horizontal scroll */
}

body {
  margin: 0;
  font-family: 'Lato', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  font-size: var(--fz-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ----- Layout Container ----- */
.container {
  max-width: 800px;
  width: 100%;
  margin: 20px auto;
  padding: 40px;
  background: var(--bg);
}

/* Keep long URLs from blowing layout */
a { color: var(--accent); }
a:hover, a:focus { text-decoration: underline; }
a, code, pre { word-break: break-word; }

/* ----- Headings & Text ----- */
h1, h2, h3 {
  color: var(--heading);
  line-height: 1.25;
  margin: 0 0 0.6em;
}

h1 {
  font-size: var(--fz-h1);
  text-align: center;
  margin-bottom: 0.9em;
}

h2 {
  font-size: var(--fz-h2);
  margin-top: 2rem;
  border-bottom: 2px solid #eaeaea;
  padding-bottom: 0.5rem;
}

h3 { font-size: var(--fz-h3); margin-top: 1.5rem; }

p {
  font-size: var(--fz-p);
  color: var(--muted);
  margin: 0 0 1rem;
}

small { color: var(--muter); }

/* ----- Author Block ----- */
.author-info {
  text-align: center;
  font-size: 0.95rem;
  color: #777;
  margin-bottom: 24px;
}
.author-info a { color: var(--accent); text-decoration: none; }
.author-info a:hover { text-decoration: underline; }

/* ----- Abstract & Keywords ----- */
.abstract {
  background: #ffffff;
  padding: 16px 18px;
  margin: 20px 0 10px;
}

.keywords {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  margin: 10px 0 22px;
}
.keywords span {
  font-weight: 400;
  color: #555;
}

/* ----- Figures & Media ----- */
figure { margin: 18px 0; }
img, video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 12px auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px;
  background: #fff;
}
figcaption {
  font-size: 0.95rem;
  color: var(--muter);
  text-align: center;
  margin-top: 6px;
}

/* Responsive video embeds (YouTube, etc.) */
.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  margin: 16px 0;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.video-container iframe,
.video-container embed,
.video-container object {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0;
}

/* ----- Tables (Responsive) ----- */
/* Wrap any table in <div class="table-responsive">…</div> */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 16px 0;
  background: #fff;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* forces horizontal scroll on small screens rather than squish */
}
th, td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}
th { background: #f2f2f2; font-weight: 700; }

/* ----- References ----- */
.references { margin-top: 28px; }
.references h2 { margin-top: 32px; }
.references p {
  margin-bottom: 12px;
  font-size: 1rem;
}
.references a {
  color: var(--muted);
  text-decoration: none;
}
.references a:hover { text-decoration: underline; }

/* ----- Tooltips (for inline reference markers, if used) ----- */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
  color: inherit;
  text-decoration: underline;
}
.tooltip .tooltiptext {
  visibility: hidden;
  max-width: 220px;
  background: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 6px 8px;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  pointer-events: none;
}
.tooltip:hover .tooltiptext { visibility: visible; opacity: 1; }

/* ----- Dividers, misc ----- */
hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* ----- Article Footer (journal info) ----- */
.article-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 2px solid #eee;
  color: var(--muter);
  font-size: 0.95rem;
  text-align: left;
}
.article-footer p { margin: 0.4rem 0; }

/* ----- Accessibility helpers ----- */
:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

/* ================================
   Responsive Breakpoints
   ================================ */

/* Tablets */
@media (max-width: 920px) {
  .container {
    padding: 28px;
    margin: 16px auto;
  }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }
  p  { font-size: 1rem; }
  .abstract { padding: 14px 16px; }
  img, video { margin: 10px auto; }
}

/* Phones */
@media (max-width: 600px) {
  .container {
    padding: 18px;
    margin: 12px auto;
  }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.05rem; }
  p  { font-size: 0.98rem; }
  .author-info { font-size: 0.9rem; }
  .abstract { font-size: 1rem; }
  figure { margin: 14px 0; }
}

/* Ultra-small phones (optional) */
@media (max-width: 360px) {
  .container { padding: 14px; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.15rem; }
}

/* ================================
   Print Styles (nice PDFs)
   ================================ */
@media print {
  html, body { background: #fff; }
  .container {
    max-width: 100%;
    margin: 0;
    padding: 0.8in;
    box-shadow: none;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
  }
  .video-container { display: none !important; }
  .table-responsive { overflow: visible; border: none; }
  table { min-width: 0; }
}
