/* =========================
   0) Font
   ========================= */
@font-face{
  font-family: "Campton-book";
  src: url("/fonts/Campton-Book.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Campton-medium";
  src: url("/fonts/Campton-Medium.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Campton-semibold";
  src: url("/fonts/Campton-SemiBold.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Campton-bold";
  src: url("/fonts/Campton-Bold.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Campton-bookitalic";
  src: url("/fonts/Campton-BookItalic.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Campton-semibolditalic";
  src: url("/fonts/Campton-SemiBoldItalic.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Campton-bolditalic";
  src: url("/fonts/Campton-BoldItalic.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* =========================
   1) Tokens
   ========================= */
:root{
  --bg:#ffffff;
  --card:#ffffff;
  --border:#e6e6e6;
  --text:#222;
  --muted:#666;
  --primary:#2f2f2f;
  --shadow:0 4px 16px rgba(0,0,0,.12);
  --radius:10px;
}

/* =========================
   2) Base
   ========================= */
*{ 
  box-sizing:border-box; 
}

/* Standalone default: allow normal page scrolling */
html,
body{ 
  margin:0; 
  padding:0; 
  height:auto;
  overflow:auto;
}

body{
  font-family:"Campton-book", Arial, Helvetica, sans-serif;
  background:var(--bg);
  color:var(--text);
  font-size:16px;
}

.hidden{ display:none !important; }

/* Embedded in iframe: suppress outer scrolling to avoid double scrollbars */
html.embedded,
html.embedded body{
  height:100%;
  overflow:hidden;
}

/* =========================
   3) Layout
   ========================= */
.page{
  height:1000px;
  max-width:1062px;
  margin:16px auto 48px auto;
  padding:0 8px;
  display:flex;
  flex-direction:column;
}

.controls{
  margin-bottom:8px;
}

/* Top controls row (dropdown + print on the right) */
.top-controls{
  display:flex;
  align-items:center;
  gap:10px;
}

/* Print button (top-right) */
.print-btn{
  border:0;
  background:transparent;
  cursor:pointer;
  padding:8px 10px;
  border-radius:8px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left:auto; /* pushes to the far right */
}

.print-btn:hover{
  background:#f2f2f2;
}

.print-btn:active{
  background:#e9e9e9;
}

.print-btn svg{
  width:18px;
  height:18px;
  display:block;
  fill:#37827D;
}

/* =========================
   4) Dropdown (single-select)
   ========================= */
.dropdown{
  position:relative;
  width:520px;
  max-width:100%;
}

.dropdown .dropdown-toggle{
  width:100%;
  border:0;
  padding:12px 16px;
  border-radius:8px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  font-size:14px;
  font-family:"Campton-book";
  min-width:0;
  color:#fff;
  background:#37827D;
}

.dropdown .dropdown-toggle .label{
  font-family:"Campton-semibold";
  min-width:0;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.dropdown .dropdown-toggle .arrow{
  flex:0 0 auto;
}

.dropdown .dropdown-menu{
  position:absolute;
  top:calc(100% + 8px);
  left:0;
  right:0;
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  display:none;
  flex-direction:column;
  overflow:hidden;
  z-index:10;
}

.dropdown .dropdown-menu.show{
  display:flex;
}

.dropdown .search-row{
  padding:8px 10px;
  border-bottom:1px solid var(--border);
}

.dropdown .search-row input{
  width:100%;
  border:0;
  outline:0;
  font-size:14px;
  padding:6px 2px;
  font-family:"Campton-book";
}

.dropdown .list{
  list-style:none;
  margin:0;
  padding:0;
  max-height:260px;
  overflow:auto;
}

.dropdown .item{
  border-bottom:1px solid #f2f2f2;
}
.dropdown .item:last-child{
  border-bottom:0;
}

.country-item{
  width:100%;
  text-align:left;
  border:0;
  background:transparent;
  padding:10px 12px;
  cursor:pointer;
  font-family:"Campton-book";
  font-size:14px;
}

.country-item:hover{
  background:#f9f9f9;
}

.country-item.active{
  background:#f1f1f1;
  font-family:"Campton-semibold";
}

/* =========================
   5) Subject nav (tabs)
   ========================= */
.subject-nav{
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  align-items:center;
  border-bottom:1px solid #d9d9d9;
  padding:10px 0 0 0;
  margin:0;
}

.subject-tab{
  border:0;
  background:transparent;
  cursor:pointer;
  padding:10px 0;
  font-size:14px;
  font-family:"Campton-semibold";
  color:#061927;
  border-bottom:3px solid transparent;
}

.subject-tab:hover{
  color:#37827D;
  border-bottom-color:#37827D;
}

.subject-tab.active{
  border-bottom-color:#37827D;
  color:#37827D;
}

/* =========================
   6) Article wrapper (app chrome)
   ========================= */
.article-block{
  flex:1;
  min-height:0;
  display:flex;
  flex-direction:column;
}

.article-scroll{
  flex:1;
  min-height:0;
  overflow:auto;
  -webkit-overflow-scrolling:touch;
  scrollbar-gutter: stable;
  padding-right: 12px;
}

.article-divider{
  display:block;
  height:0;
  border-top:1px solid #d9d9d9;
}

.article-meta{
  display:flex;
  align-items:baseline;
  gap:10px;
  margin-top:6px;
  flex-wrap:wrap;
}

.direct-link{
  color:#061927;
  text-decoration:none;
  font-size:12px;
  font-family:"Campton-book", Arial, Helvetica, sans-serif;
  display:inline-flex;
  align-items:center;
  gap:6px;
}

.direct-link:hover,
.direct-link:focus-visible{
  text-decoration:underline;
}

.direct-link-icon{
  font-size:12px;
  line-height:1;
  opacity:.75;
}

.direct-link:hover .direct-link-icon,
.direct-link:focus-visible .direct-link-icon{
  opacity:1;
}

.edit-date{
  color:var(--muted);
  font-style:italic;
  font-size:12px;
}

/* =========================
   7) Loading + error
   ========================= */
.page-loading{
  display:flex;
  justify-content:center;
  align-items:center;
  padding:10px 0;
  color:#333;
  font-size:16px;
  font-weight:600;
}

.page-loading .dots{
  display:inline-block;
  width:20px;
  text-align:left;
  margin-left:2px;
}

.error-box{
  background:#fdecea;
  border:1px solid #f5c2c7;
  color:#7a3139;
  padding:12px 14px;
  border-radius:10px;
}

/* =========================
   8) Responsive
   ========================= */
@media (max-width:560px){
  .dropdown{
    width:100%;
  }
  .subject-nav{
    gap:10px;
  }
  .top-controls{
    gap:8px;
  }
  .dropdown .search-row input{
    font-size:16px; /* prevents iOS focus zoom */
  }
}

/* =========================
   9) Print (app chrome only)
   ========================= */
@media print{
  /* Don’t print the print button itself */
  .print-btn{
    display:none !important;
  }

  /* Ensure the dropdown menu (the open list) never prints */
  .dropdown .dropdown-menu{
    display:none !important;
  }

  /* Use full width of printable area */
  .page{
    max-width:none !important;
    margin:0 !important;
    padding:0 !important;

    /* IMPORTANT: allow the app to expand for printing */
    height:auto !important;
  }

  /* IMPORTANT: if embedded, override embed no-scroll too */
  html,
  body,
  html.embedded,
  html.embedded body{
    height:auto !important;
    overflow:visible !important;
    background:#fff !important;
  }

  /* IMPORTANT: remove inner scrolling so the full article prints */
  .article-block,
  .article-scroll{
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
  }

  /* Optional but helps some browsers not clip flex children */
  .content{
    height:auto !important;
    min-height:auto !important;
  }

  .dropdown .dropdown-toggle{
    background:#000 !important;
    color:#fff !important;
    border:1px solid #d9d9d9 !important;
  }

  .dropdown .dropdown-toggle .label,
  .dropdown .dropdown-toggle .arrow{
    color:#000 !important;
  }

  /* Ensure meta link is visible in print */
  .direct-link{
    color:#000 !important;
    text-decoration:none !important;
  }
}