/* styles.css – sitetation.click
   Updated: 2025-10-20
   - Reduced main padding to eliminate excess whitespace
*/

/* ===== CSS Vars ===== */
:root{
  --bg:#fff;
  --ink:#111;
  --muted:#666;
  --rule:#e7e7e7;
  --accent:#0a0a0a;
  --nyt-serif: "Source Serif 4", Georgia, "Times New Roman", Times, serif;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Inter, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;

  --hpad: clamp(14px, 2.5vw, 28px);
  --vpad: clamp(10px, 2.2vw, 24px);
  --maxw: 1200px;
}

/* Reset-ish */
*{ box-sizing: border-box; }
html, body{ height:100%; background:var(--bg); color:var(--ink); }
body{ font: 15px/1.5 var(--sans); margin:0; }
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration: none; }
a:hover{ text-decoration: underline; }

/* ===== Header / Tabs ===== */
.site-header{
  background:var(--bg);
  border-bottom:1px solid var(--rule);
  padding-top: 43px; /* Account for fixed masthead height */
}
.masthead{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg);
  display:flex; align-items:flex-end; justify-content:space-between;
  gap:12px; padding:10px var(--hpad);
  border-bottom: 1px solid var(--rule);
}
.masthead h1{ font:700 20px/1 var(--sans); margin:0; letter-spacing:.2px; display:flex; align-items:baseline; gap:.4ch;}
.masthead .dot{ color:#bbb; }
.masthead .tag{ display:inline-block; font: 600 12px/1 var(--sans); color:#999; }

.tabs{
  display:flex; gap:10px; padding:6px var(--hpad) 10px;
  max-width:var(--maxw); margin:0 auto;
}
.tab{
  appearance:none; background:#f6f6f6; color:#111; border:1px solid var(--rule);
  border-radius:999px; padding:8px 12px; cursor:pointer; font:600 13px/1 var(--sans);
}
.tab.active{ background:#111; color:#fff; }

/* ===== Layout ===== */
main{ 
  max-width:var(--maxw); 
  margin:0 auto; 
  padding: 20px var(--hpad) 50px; /* Reduced from 100px to account for header padding */
}
.grid{
  display:grid; 
  gap: clamp(14px, 2vw, 24px);
  grid-auto-flow: row;
}

@media (min-width: 960px){
  .grid{
    grid-template-columns: 2fr 1fr;
    align-items: start;
  }
  .grid > .block:nth-of-type(1){ grid-column: 1; }
  .grid > .block:nth-of-type(2){ grid-column: 2; }
}

/* Blocks */
.block{
  border:1px solid var(--rule);
  border-radius:16px;
  padding: 10px 12px 14px;
  background: var(--bg);
  position: relative;
  /* NO overflow declarations - sticky needs clean parent chain */
  width: 100%;
  box-sizing: border-box;
}

/* Staff Pick block (6th child in main pane) needs overflow hidden to prevent archive grid overflow */
#pane-main .block:nth-child(6){
  overflow: hidden;
}

.block > h2{
  font: 700 14px/1.2 var(--sans);
  letter-spacing:.4px; text-transform:uppercase;
  color:#333; 
  margin: 4px 4px 10px;
  padding: 0;
  background: transparent;
  position: static;
}

@media (max-width: 768px){
  /* Make section headers sticky on mobile - ALWAYS with white background */
  #pane-main .block:nth-child(1) > h2,
  #pane-main .block:nth-child(2) > h2,
  #pane-main .block:nth-child(3) > h2,
  #pane-mans .block > h2{
    position: -webkit-sticky;
    position: sticky;
    top: 42px;
    z-index: 10;
    /* Always show white background treatment */
    background: #fff;
    margin: -10px -12px 10px -12px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--rule);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  }
}

/* Collapsed state - hide everything except the header */
.block.is-collapsed > *:not(h2) {
  display: none !important;
}

.block > h2 + *{ margin-top: 6px; }

/* ===== NYT Top Stories ===== */

.cards{ 
  list-style:none; 
  padding:0; 
  margin:0; 
  display:grid; 
  gap:16px; 
}
.cards .story,
.card.nyt,
.card.guardian{ display:grid; grid-template-columns: 1fr; gap:10px; }

.card.nyt a,
.card.nyt a:hover,
.card.nyt a:focus,
.card.nyt a:visited { text-decoration: none !important; }

.card.guardian a,
.card.guardian a:hover,
.card.guardian a:focus,
.card.guardian a:visited { text-decoration: none !important; }

.card.nyt .copy h3,
.cards .title{ 
  font-family: var(--nyt-serif);
  font-weight: 600;
  font-size: clamp(19px, 2.2vw, 22px);
  line-height: 1.25;
  margin:0;
}
.card.nyt .summary{
  font-family: var(--nyt-serif);
  font-size: 16px; color:#333; margin:6px 0 0;
}
.card.nyt .byline{ font-size:12px; color:#777; margin-top:4px; }

.card.guardian .copy h3{
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(18px, 2.2vw, 21px);
  line-height: 1.2;
  margin:0;
}
.card.guardian .summary{
  font-family: var(--sans);
  font-size: 15px; color:#333; margin:6px 0 0;
}
.card.guardian .byline{ font-size:12px; color:#777; margin-top:4px; }

.card.nyt.lead .copy h3{ font-size: clamp(24px, 3.2vw, 30px); }
.card.nyt.lead .summary{ font-size: clamp(17px, 2.2vw, 18px); }

.card.guardian.lead .copy h3{ font-size: clamp(26px, 3.2vw, 32px); }
.card.guardian.lead .summary{ font-size: clamp(16px, 2.2vw, 17px); }

.img-wrap.ratio-3x2{ 
  position:relative; 
  width:100%; 
  aspect-ratio:3/2; 
  overflow:hidden; 
  background:#f6f6f6; 
  border-radius:12px; 
}
.card.nyt.lead .img-wrap.ratio-3x2,
.card.guardian.lead .img-wrap.ratio-3x2{ 
  aspect-ratio:16/9; 
}
.img-wrap.ratio-3x2 img{ width:100%; height:100%; object-fit:cover; }

.img-wrap .logo-badge{
  position:absolute; 
  left:8px; 
  top:8px; 
  z-index:2;
  display:inline-flex; 
  align-items:center; 
  justify-content:center;
  height:26px; 
  padding:3px 6px; 
  border-radius:6px;
  background: rgba(0,0,0,.72);
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.img-wrap .logo-badge .src-logo-img{ 
  display:block; 
  height:18px; 
  width:auto; 
}

.img-overlay{
  position:absolute; 
  right:8px; 
  bottom:8px;
  background:rgba(0,0,0,.58); 
  color:#fff;
  font-size:11px; 
  line-height:1; 
  padding:4px 6px; 
  border-radius:6px;
}

.card.nyt.thumbonly a,
.card.guardian.thumbonly a{
  display:grid;
  grid-template-columns:56px 1fr;
  gap:12px;
  align-items:start;
  border:1px solid var(--rule);
  border-radius:12px;
  padding:8px 10px;
  background:#fff;
}
.card.nyt.thumbonly .thumb.sq,
.card.guardian.thumbonly .thumb.sq{
  width:56px; height:56px;
  border-radius:10px; 
  overflow:hidden; 
  background:#f2f2f2; 
  border:1px solid var(--rule);
}
.card.nyt.thumbonly .thumb.sq img,
.card.guardian.thumbonly .thumb.sq img{ width:100%; height:100%; object-fit:cover; }
.card.nyt.thumbonly .copy,
.card.guardian.thumbonly .copy{ padding:0; }
.card.nyt.thumbonly .copy h3{
  font-family: var(--nyt-serif);
  font-weight:600;
  font-size: clamp(17px, 2vw, 19px);
  line-height:1.25;
  margin:0;
}
.card.guardian.thumbonly .copy h3{
  font-family: var(--sans);
  font-weight:700;
  font-size: clamp(16px, 2vw, 18px);
  line-height:1.2;
  margin:0;
}
.card.nyt.thumbonly .summary,
.card.nyt.thumbonly .byline,
.card.guardian.thumbonly .summary,
.card.guardian.thumbonly .byline{ display:none !important; }

@media (min-width: 960px){
  #nyt-list.cards,
  #guardian-list.cards{
    display:grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap:16px;
  }
  #nyt-list .card.nyt.lead,
  #nyt-list .card.nyt.smallimg,
  #guardian-list .card.guardian.lead,
  #guardian-list .card.guardian.smallimg{
    grid-column: 1 / -1;
  }
  .card.nyt.thumbonly a,
  .card.guardian.thumbonly a{ grid-template-columns:72px 1fr; }
  .card.nyt.thumbonly .thumb.sq,
  .card.guardian.thumbonly .thumb.sq{ width:72px; height:72px; }
}

/* ===== Embeds ===== */
.embed iframe{ display:block; width:100%; border:0; }
.embed.wnyc iframe{ height:193px; }
#mixcloud-embed iframe{ height: 180px; }

/* ===== Staff Pick (aligned content, genre nav, scrolling) ===== */

#staff-pick{ 
  position:relative;
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
}

.sp-archive{
  overflow: hidden;
}

.block > h2.sp-has-toggle{ position:relative; padding-right:34px; margin: 4px 4px 10px; }
.sp-ctrl{
  position:absolute; top:0; right:0;
  display:flex; align-items:center; gap:8px;
  padding:0;
  z-index: 10;
}
.sp-btn{
  appearance:none; background:transparent; border:none; padding:0; cursor:pointer;
  display:inline-grid; place-items:center;
}
.sp-btn .icon-grid9{ display:grid; }
.sp-btn .icon-square{ display:none; }

.icon-grid9{
  width:22px; height:22px; display:grid; grid-template-columns:repeat(3,1fr); gap:2px;
}
.icon-grid9 span{
  width:100%; height:100%;
  background:#777;
  border:1px solid #555;
  box-sizing:border-box;
}
.icon-square{ width:22px; height:22px; border:2px solid #555; background:transparent; }

.sp-current{
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.staff-card{ display:block; width:100%; }
.staff-card .sqwrap{ 
  width:100%; 
  aspect-ratio:1/1; 
  border-radius:12px; 
  border:1px solid var(--rule); 
  overflow:hidden; 
  background:#f6f6f6; 
}
.staff-card img{ width:100%; height:100%; object-fit:cover; }

.staff-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 0;
}

.staff-date {
  font-size: 12px;
  color: #888;
}

.staff-genre {
  appearance: none;
  font-size: 11px;
  font-weight: 400;
  color: #898989;
  background-color: #e0e0e0;
  padding: 3px 8px;
  border-radius: 2px;
  border: none;
  display: inline-block;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

@media (hover: hover) {
  .staff-genre:hover {
    background-color: #d0d0d0;
    color: #777;
  }
}

.staff-genre:active {
  background-color: #c8c8c8;
}

/* Archive/Genre view */
.sp-archive{ 
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  box-sizing: border-box;
  overflow: hidden;
}

.sp-grid-scroll{
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  box-sizing: border-box;
}

@media (min-width: 769px){
  .sp-grid-scroll{
    max-height: calc(120px * 3 + 20px);
  }
  
  .sp-grid-scroll::-webkit-scrollbar {
    width: 8px;
  }
  .sp-grid-scroll::-webkit-scrollbar-track {
    background: transparent;
  }
  .sp-grid-scroll::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 4px;
    transition: background 0.2s;
  }
  .sp-grid-scroll:hover::-webkit-scrollbar-thumb {
    background: #ccc;
  }
  .sp-grid-scroll::-webkit-scrollbar-thumb:hover {
    background: #999;
  }
}

.sp-grid{
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sp-tile,
.sp-tile-empty{
  position:relative;
  border:1px solid var(--rule);
  background:#f6f6f6;
  border-radius:12px;
  overflow:hidden;
  aspect-ratio:1/1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sp-tile-empty{
  background: transparent;
  border-color: transparent;
}

.sp-tile img{ width:100%; height:100%; object-fit:cover; }

.sp-date{
  position:absolute; left:50%; top:50%; transform:translate(-50%, -50%);
  background:#fff; color:#000;
  padding:6px 8px;
  font: 700 12px/1 var(--sans);
  border-radius:0;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}

/* Genre navigation footer */
.sp-genre-nav{
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 0 4px;
  margin-top: 8px;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}

.sp-genre-nav::-webkit-scrollbar {
  display: none;
}
.sp-genre-nav {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.genre-nav-btn{
  appearance: none;
  font-size: 11px;
  font-weight: 400;
  color: #898989;
  background-color: #e0e0e0;
  padding: 4px 10px;
  border-radius: 2px;
  border: none;
  white-space: nowrap;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  pointer-events: auto;
}

.genre-nav-btn.active{
  background-color: #c8c8c8;
  color: #777;
}

@media (hover: hover) {
  .genre-nav-btn:hover {
    background-color: #d0d0d0;
    color: #777;
  }
}

/* ===== Buttons ===== */
.load-more{
  appearance:none; border:1px solid var(--rule); background:#fafafa; color:#111;
  font:600 13px/1 var(--sans); padding:8px 12px; border-radius:999px; cursor:pointer;
  display:block; margin: 8px auto 0;
}
.load-more:hover{ background:#f0f0f0; }

/* ===== Spinner ===== */
.spinwrap{
  display:flex; align-items:center; justify-content:center; padding:18px 0;
}
.spinner{
  width:22px; height:22px; border-radius:50%;
  border:2px solid #ddd; border-top-color:#111;
  animation: spin 0.9s linear infinite;
}
@keyframes spin{ to { transform: rotate(360deg); } }

/* ===== Footer Rotator ===== */
.site-footer{
  max-width:var(--maxw); margin:0 auto; padding: 30px var(--hpad) 50px;
  color:#777; border-top:1px solid var(--rule);
  display:flex; justify-content:space-between; align-items:center; gap:10px;
}
.footer-rotator{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:56px;
  padding:12px 16px;
  border-top:1px solid rgba(0,0,0,.08);
  color:var(--text, #111);
  font-size:1rem;
  line-height:1.3;
  gap:.5ch;
}
.footer-rotator .phrase{
  display:inline-flex; align-items:center; gap:.5ch;
  opacity:0; transform:translateY(6px);
  transition:opacity .35s ease, transform .35s ease;
  will-change: opacity, transform;
}
.footer-rotator .phrase.is-on{ opacity:1; transform:translateY(0); }
.footer-rotator .text{ white-space:nowrap; }
.footer-rotator .emoji{
  display:inline-block; font-size:1.1em; transform-origin:50% 50%;
}
@keyframes em-rotate { from{transform:rotate(0deg);} to{transform:rotate(360deg);} }
@keyframes em-shiver {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-1px); }
  40%     { transform: translateX(1px); }
  60%     { transform: translateX(-1px); }
  80%     { transform: translateX(1px); }
}
@keyframes em-grow { 0%,100%{transform:scale(1);} 50%{transform:scale(1.18);} }
.em-rotate{ animation: em-rotate 6s linear infinite; }
.em-shiver{ animation: em-shiver .9s linear infinite; }
.em-grow{   animation: em-grow 1.8s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce){
  .footer-rotator .phrase{ transition:none; }
  .em-rotate, .em-shiver, .em-grow{ animation:none; }
}

/* Utility */
.small{ font-size:12px; }
code{ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size:12px; }

/* ===== Visited greying ===== */
.card.nyt.is-visited img,
.card.guardian.is-visited img,
.mini.is-visited img,
.l-card.is-visited img{
  filter: grayscale(100%);
  opacity: 0.55;
}
.card.nyt.is-visited .copy,
.card.guardian.is-visited .copy,
.mini.is-visited .mini-title,
.l-card.is-visited .h{
  color: var(--muted);
}

/* ===== Local (merged) ===== */

.img.ratio-16x9,
.img.ratio-3x2{
  position:relative; 
  width:100%; 
  overflow:hidden; 
  border-radius:12px; 
  background:#f6f6f6;
}
.img.ratio-16x9{ aspect-ratio:16/9; }
.img.ratio-3x2{  aspect-ratio:3/2;  }
.img img{ width:100%; height:100%; object-fit:cover; }

.logo-badge{
  position:absolute; left:8px; top:8px; z-index:2;
  display:inline-flex; align-items:center; justify-content:center;
  height:26px; padding:3px 6px; border-radius:6px;
  background: rgba(0,0,0,.72);
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.logo-badge .src-logo-img{ display:block; height:18px; width:auto; }

.photo-credit{
  position:absolute; right:8px; bottom:8px; z-index:2;
  background: rgba(0,0,0,.72);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.25);
}

.logo-badge.sm{
  left:4px; top:4px; height:20px; padding:2px 5px; border-radius:5px;
}
.logo-badge.sm .src-logo-img{ height:14px; }

.thumb.sq{ position:relative; }

.l-card.serif .h{ font-family: var(--nyt-serif); font-weight:600; }
.l-card.sans  .h{ font-family: var(--sans); font-weight:700; }

.l-card.lead a{
  display:block;
  border:1px solid var(--rule); border-radius:14px; background:#fff; overflow:hidden;
}
.l-card.lead .copy{ padding:12px 14px; }
.l-card.lead .h{
  font-size: clamp(22px, 3vw, 28px);
  line-height:1.15;
  margin:0;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
}
.l-card.lead .sum{
  margin:6px 0 0; color:#333; font-family: var(--nyt-serif);
}
.l-card.lead .by{ font-size:12px; color:#777; margin-top:6px; }

.l-card.med a{
  display:block;
  border:1px solid var(--rule); border-radius:14px; background:#fff; overflow:hidden;
}
.l-card.med .copy{ padding:12px 14px; }
.l-card.med .h{
  font-size: clamp(18px, 2.2vw, 21px);
  line-height:1.22;
  margin:0;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
}
.l-card.med .by{ font-size:12px; color:#777; margin-top:6px; }

.l-card.sm.row a{
  display:grid;
  grid-template-columns:56px 1fr;
  gap:12px;
  align-items:start;
  border:1px solid var(--rule);
  background:#fff;
  border-radius:14px;
  padding:8px 10px;
}
.thumb.sq{
  width:56px; 
  aspect-ratio:1/1;
  border-radius:10px; 
  overflow:hidden;
  background:#f2f2f2; 
  border:1px solid var(--rule);
}
.thumb.sq img{ width:100%; height:100%; object-fit:cover; }
.l-card.sm .copy{ padding:0; }
.l-card.sm .h{
  font-size: 15px;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient: vertical; overflow:hidden;
}

.local-top{ display:grid; gap:12px; }
.local-lead{ }
.local-mediums{ display:grid; gap:12px; grid-template-columns:1fr; }
.local-smalls{ display:grid; gap:10px; }

@media (min-width: 960px){
  .local-top{
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .local-lead,
  .local-mediums,
  .local-smalls{ grid-column:1; }
  .local-mediums{ display:grid; gap:12px; grid-template-columns:1fr; }
  .local-smalls{ display:grid; gap:10px; grid-template-columns: 1fr; }
  .l-card.sm.row a{ grid-template-columns:72px 1fr; }
  .thumb.sq{ width:72px; }
}

.local-flow{
  display:grid; gap:12px; margin-top:12px;
  grid-template-columns: 1fr !important;
}

.note{ color:#777; font-size:13px; padding:8px 6px; }
.empty{ color:#777; font-size:14px; padding: 8px 6px; }

/* ===== Extras / Man's View ===== */

.mans-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}

.mans-section:last-child {
  border-bottom: none;
}

.mans-header {
  font: 700 14px/1.2 var(--sans);
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #333;
  margin: 0 0 12px;
}

.mans-list {
  display: grid;
  gap: 10px;
}

.mans-item {
  display: block;
}

.mans-item a {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  transition: background 0.15s ease;
}

.mans-item a:hover {
  background: #f9f9f9;
}

/* Only show thumb if it exists (will be in DOM) */
.mans-thumb {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: #f3f3f3;
  border: 1px solid var(--rule);
  flex-shrink: 0;
}

.mans-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Items without images will have no grid-template-columns override needed */
.mans-item a:not(:has(.mans-thumb)) {
  grid-template-columns: 1fr;
}

.mans-content {
  padding: 0;
  min-width: 0;
}

.mans-title {
  font: 600 15px/1.3 var(--sans);
  color: var(--ink);
}

.mans-show-more {
  appearance: none;
  border: 1px solid var(--rule);
  background: #fafafa;
  color: #111;
  font: 600 13px/1 var(--sans);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: block;
  margin: 12px auto 0;
}

.mans-show-more:hover {
  background: #f0f0f0;
}

/* Visited state for Extras */
.mans-item.is-visited .mans-thumb img {
  filter: grayscale(100%);
  opacity: 0.55;
}

.mans-item.is-visited .mans-title {
  color: var(--muted);
}