:root{
  --frost:#c3bdb8;
  --softBtn:rgba(221,218,218,1);
  --text:#1f2937;
  --muted:rgba(31,41,55,0.70);
  --muted2:rgba(31,41,55,0.55);
  --border:rgba(31,41,55,0.14);
  --divider:rgba(31,41,55,0.10);
  --shadow:0 18px 60px rgba(17,24,39,0.10);
  --glass:rgba(243,244,246,0.35);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
img{ max-width:100%; height:auto; display:block; } /* global guard */

body{
  margin:0;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  background: var(--frost);
  color: var(--text);
}

.container{ width:min(1100px, 92vw); margin:0 auto; }

/* ===== HEADER ===== */
.topbar{
  position:sticky;
  top:0;
  z-index:50;
  border-bottom:1px solid rgba(31,41,55,0.10);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar__inner{
  width:min(1100px, 92vw);
  margin:0 auto;
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}
.brand{
  text-decoration:none;
  color:var(--text);
  font-weight:800;
  letter-spacing:0.2px;
  font-size:16px;
}
.brand__dot{ color:#f59e0b; }

.nav{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.nav__link{
  text-decoration:none;
  color:rgba(31,41,55,0.82);
  font-weight:700;
  font-size:13px;
  padding:10px 12px;
  border-radius:999px;
  border:1px solid transparent;
  transition:160ms ease;
}
.nav__link:hover{
  background: rgba(221,218,218,0.75);
  border:1px solid rgba(31,41,55,0.14);
  color:#0b0f18;
}
.nav__link.is-active{
  background: var(--softBtn);
  border:1px solid rgba(31,41,55,0.18);
  color:#0b0f18;
}

/* ===== POST META ===== */
.post{ padding: 26px 0 36px; }

.postMeta{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom: 14px;
}

.backLink{
  text-decoration:none;
  color: rgba(31,41,55,0.82);
  font-weight:800;
  transition:160ms ease;
}
.backLink:hover{
  color:#000;
  text-decoration:underline;
  text-underline-offset:4px;
}

.metaRight{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
  color: var(--muted2);
  font-size: 12.5px;
}
.pill{
  background: rgba(221,218,218,0.75);
  border: 1px solid rgba(31,41,55,0.12);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  color: rgba(31,41,55,0.86);
}
.dotSep{ opacity:0.7; }
.reading{ color: var(--muted); }

/* ===== NEWSPAPER BLOCK ===== */
.paper{
  background: rgba(195,189,184,0.55);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 18px;
  overflow:hidden; /* extra safety: clips anything that somehow overflows */
}

.paperTop{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom: 10px;
}
.paperMini{
  font-size: 12px;
  font-weight: 800;
  color: rgba(31,41,55,0.70);
  letter-spacing: 0.06em;
}

.paperTitle{
  margin: 0;
  font-weight: 900;
  letter-spacing: 0.02em;
  font-size: clamp(34px, 6vw, 62px);
  line-height: 0.98;
  color: #0b0f18;
  text-transform: uppercase;
}
.paperSubTitle{
  margin: 6px 0 0;
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: clamp(18px, 3.3vw, 28px);
  line-height: 1.1;
  color: rgba(11,15,24,0.92);
  text-transform: uppercase;
}
.paperRule{
  height: 2px;
  background: rgba(31,41,55,0.22);
  margin: 14px 0 16px;
}

/* ===== DESKTOP GRID ===== */
.paperGrid{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items:start;
}

.paperText{ padding-right: 6px; }

.lead{
  margin: 0 0 12px;
  font-size: 14.6px;
  line-height: 1.8;
  color: rgba(31,41,55,0.92);
  font-weight: 700;
  text-align: justify;
}
.paperText p{
  margin: 0 0 12px;
  font-size: 14.2px;
  line-height: 1.85;
  color: rgba(31,41,55,0.90);
  text-align: justify;
  text-justify: inter-word;
}

.sectionHead{
  margin: 14px 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(31,41,55,0.78);
}

/* Core point */
.pullBlock{
  border: 1px solid rgba(31,41,55,0.16);
  background: rgba(221,218,218,0.60);
  border-radius: 16px;
  padding: 12px 12px;
  margin: 14px 0 12px;
}
.pullTitle{
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 900;
  color: rgba(31,41,55,0.78);
  margin-bottom: 6px;
}
.pullQuote{
  margin:0;
  font-weight: 800;
  color: rgba(11,15,24,0.92);
  line-height: 1.75;
  text-align: justify;
}

/* ===== RIGHT COLUMN ===== */
.paperImage{
  display:grid;
  gap: 12px;
}

.imgFigure{
  margin: 0;
  border-radius: 22px;
  overflow: hidden; /* KEY: clips the image to rounded corners */
  border: 1px solid rgba(31,41,55,0.14);
  background: rgba(243,244,246,0.55);
}

.imgFigure img{
  width: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(0.85) contrast(1.02);
}

.imgFigure figcaption{
  font-size: 12px;
  color: rgba(31,41,55,0.65);
  padding: 10px 10px;
  background: rgba(221,218,218,0.55);
  border-top: 1px solid rgba(31,41,55,0.10);
}

.sideFacts, .tagsCard{
  border: 1px solid rgba(31,41,55,0.14);
  background: rgba(221,218,218,0.55);
  border-radius: 18px;
  padding: 12px 12px;
}

.sideFacts h4, .tagsCard h4{
  margin:0 0 8px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(31,41,55,0.78);
}

.sideFacts ul{
  margin:0;
  padding-left: 16px;
  display:grid;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(31,41,55,0.88);
  text-align: justify;
}

.tags{ display:flex; flex-wrap:wrap; gap:8px; }
.tag{
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(221,218,218,0.70);
  border: 1px solid rgba(31,41,55,0.12);
  color: rgba(31,41,55,0.86);
}

/* ===== FLOAT MAGAZINE MODE (DESKTOP ONLY) ===== */
.paperFlow{ display:block; }
.paperFlow .paperImage{
  float:right;
  width:min(360px, 34%);
  margin-left:24px;
}
.paperFlow .paperText{
  width:auto;
  max-width:none;
}
.paperClear{ clear:both; height:0; }

/* ===== FOOTER (unchanged style) ===== */
.footer{
  background:#0b1220;
  color:rgba(255,255,255,0.86);
  padding:30px 0;
  margin-top:0;
}
.footer__inner{
  width:min(1100px, 92vw);
  margin:0 auto;
  display:grid;
  grid-template-columns:1fr auto auto;
  gap:14px;
  align-items:center;
}
.footer__name{font-weight:900;letter-spacing:0.2px}
.footer__meta{font-size:12px;opacity:0.8;margin-top:6px}
.footer__right{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.footer__right a{
  color:rgba(255,255,255,0.86);
  text-decoration:none;
  font-weight:700;
  font-size:12.5px;
  transition:160ms ease;
}
.footer__right a:hover{
  color:#fff;
  text-decoration:underline;
  text-underline-offset:4px;
}
.footer__copy{font-size:12px;opacity:0.7;text-align:right}

/* ===== RESPONSIVE ===== */
@media (max-width: 980px){
  .paperGrid{ grid-template-columns: 1fr; }
  .footer__inner{ grid-template-columns: 1fr; }
  .footer__copy{ text-align:left; }
}

@media (max-width: 900px){
  .topbar__inner{
    height:auto;
    padding:12px 0;
    align-items:flex-start;
    flex-direction:column;
    gap:10px;
  }
  .nav{
    width:100%;
    justify-content:flex-start;
    gap:8px;
  }
  .nav__link{
    padding:9px 11px;
    font-size:13px;
  }
}

/* ===== MOBILE: REQUIRED ORDER + HERO IMAGE ===== */
@media (max-width: 520px){
  .container{ width:min(1100px, 94vw); }
  .post{ padding: 18px 0 28px; }

  /* stop floats on mobile */
  .paperFlow .paperImage{
    float:none;
    width:100%;
    margin:0;
  }

  .paperTop{
    flex-direction:column;
    align-items:flex-start;
    gap:6px;
  }
  .paperRule{ margin: 12px 0 14px; }

  /* Turn into vertical flow + reorder */
  .paperGrid.paperFlow{
    display:flex;
    flex-direction:column;
    gap:16px;
    align-items:center;
  }

  /* Make aside children reorderable */
  .paperGrid.paperFlow .paperImage{ display: contents; }

  .paperGrid.paperFlow .imgFigure { order: 1; }
  .paperGrid.paperFlow .sideFacts { order: 2; }
  .paperGrid.paperFlow .pullBlock { order: 3; }
  .paperGrid.paperFlow .paperText { order: 4; }
  .paperGrid.paperFlow .tagsCard  { order: 5; }

  /* Centered framed image that can never spill */
  .imgFigure{
    width: min(92vw, 600px);
    margin: 0 auto;
    border-radius: 22px;
    overflow: hidden;
  }

  .imgFigure img{
    width: 100%;
    height: min(72vh, 520px);
    object-fit: cover;
  }

  .imgFigure figcaption{
    margin:0;
    padding: 10px 12px;
    font-size: 11.5px;
  }

  /* Better reading on mobile */
  .paperText{ padding-right:0; }
  .lead, .paperText p, .pullQuote, .sideFacts ul{
    text-align:left;
    text-justify:auto;
  }
  .paperText p{ line-height: 1.8; font-size: 14px; }
}
@media (max-width: 520px){
  .imgFigure img{
    height: auto;          /* remove forced hero height */
    object-fit: contain;   /* show full image */
    background: #0b0f18;   /* optional: nice letterbox if needed */
  }
}
/* --- Kill horizontal scrolling on mobile + ensure image never exceeds container --- */
@media (max-width: 520px) {

  html, body {
    overflow-x: hidden;
  }

  /* make sure the card and all children respect the viewport */
  .paper, .paper * {
    max-width: 100%;
  }

  /* the figure must use container width, not vw */
  .imgFigure {
    width: 100%;
    margin: 0;
  }

  /* show full image without cropping */
  .imgFigure img {
    width: 100%;
    height: auto;
    object-fit: contain;
  }
}