/* Chip's Daily Journal — cream paper, ink, red rules. Square corners. */
:root {
  --paper: #fcfbf7;
  --ink: #1a1a1a;
  --ink-soft: #3d3d3d;
  --muted: #6b6b6b;
  --hairline: #e2e0d9;
  --rule: #bf242a;
  --link: #005a9c;
  --serif-display: "Libre Baskerville", "Times New Roman", serif;
  --serif: "Source Serif 4", "Georgia", serif;
  --sans: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: #efece4;
  color: var(--ink);
  font-family: var(--serif);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}
a:hover { color: var(--link); }

button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: inherit;
  touch-action: manipulation;
}

.paper {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--paper);
  min-height: 100dvh;
  min-width: 0;
  overflow-x: hidden;
  padding: 10px 32px 48px;
  box-shadow: 0 0 0 1px var(--hairline), 0 18px 50px rgba(0, 0, 0, 0.08);
}

.paper-utility,
.paper-dateline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 16px;
  font-family: var(--sans);
}

.paper-utility > :first-child,
.paper-dateline > :first-child { justify-self: start; }
.paper-utility > :nth-child(2),
.paper-dateline > :nth-child(2) { justify-self: center; text-align: center; }
.paper-utility > :last-child,
.paper-dateline > :last-child { justify-self: end; }

.paper-utility {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 0 10px;
}

.paper-utility a {
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 5px 10px;
  letter-spacing: 0.06em;
  width: auto;
}
.paper-utility a:hover { background: var(--ink); color: var(--paper); }

.paper-rule {
  height: 1px;
  background: var(--ink);
}
.paper-rule-double {
  height: 5px;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 0 / 100% 1px no-repeat,
    linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 1px no-repeat;
}

.paper-masthead {
  margin: 8px 0;
  text-align: center;
  font-family: var(--serif-display);
  font-size: clamp(1.7rem, 4.7vw, 3.7rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.paper-dateline {
  padding: 8px 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--ink);
}

.paper-sections {
  display: flex;
  justify-content: center;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 0;
  margin: 0;
  padding: 0;
  border-bottom: 2px solid var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.paper-sections::-webkit-scrollbar { display: none; }

.paper-sections button,
.paper-sections a {
  flex: 0 0 auto;
  padding: 10px 14px;
  margin-bottom: -2px;
  border-bottom: 2px solid transparent;
  color: var(--ink);
  width: auto;
  white-space: nowrap;
}
.paper-sections button.is-active {
  color: var(--rule);
  border-bottom-color: var(--rule);
}

.paper-status {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  padding: 48px 0;
}

.lead-row {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start;
  column-gap: 28px;
  padding: 20px 0 0;
  border-bottom: 1px solid var(--hairline);
}

.lead-story,
.rail-story,
.grid-story {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.lead-story {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-bottom: 20px;
}
.lead-story:hover .story-hed { color: var(--link); }

.lead-photo {
  display: block;
  width: 100%;
  height: 320px;
  object-fit: cover;
  background: #ece8de;
}

.photo-frame {
  position: relative;
  display: block;
  overflow: hidden;
}
.lead-story > .photo-frame { width: 100%; }
.photo-frame--thumb {
  width: 112px;
  height: 76px;
  flex-shrink: 0;
  background: #ece8de;
  overflow: visible;
}
.photo-stamp {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  margin: 0;
  padding: 4px 10px;
  border: 3px solid var(--rule);
  color: var(--rule);
  background: rgba(252, 251, 247, 0.82);
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
  transform: rotate(-11deg);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
}
.photo-frame.is-ready .photo-stamp,
.story-figure.is-ready .photo-stamp {
  opacity: 1;
}
.photo-frame--thumb .photo-stamp {
  right: 4px;
  bottom: 4px;
  padding: 2px 6px;
  font-size: 14px;
  letter-spacing: 0.05em;
  border-width: 2px;
}

.kicker {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  color: var(--rule);
  border-top: 1px solid var(--rule);
  padding-top: 6px;
  width: fit-content;
}

.story-hed {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.12;
}

.lead-story .story-hed {
  font-size: clamp(1.8rem, 3.2vw, 2.85rem);
}

.dek {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.stamp {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--muted);
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  border-left: 1px solid var(--hairline);
  padding-left: 24px;
}

.rail-story {
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
}
.rail-story:first-child { padding-top: 0; }
.rail-story:last-child { border-bottom: 0; }
.rail-story .story-hed { font-size: 1.12rem; margin: 6px 0 8px; }
.rail-story .dek {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rail-story:hover .story-hed { color: var(--link); }

.whats-news {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: 24px;
  padding: 18px 0 8px;
  border-bottom: 1px solid var(--ink);
}
.whats-news-head {
  grid-column: 1 / -1;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--rule);
  border-top: 1px solid var(--rule);
  padding-top: 6px;
  margin: 0 0 8px;
  width: fit-content;
}
.strip-story {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  text-align: left;
  padding: 0 0 12px;
  cursor: pointer;
  border-right: 1px solid var(--hairline);
  padding-right: 16px;
}
.strip-story:last-child { border-right: 0; padding-right: 0; }
.strip-story .story-hed { font-size: 1.05rem; margin: 6px 0 0; }
.strip-story .dek,
.strip-story .stamp { display: none; }
.strip-story:hover .story-hed { color: var(--link); }

.desk-well {
  padding-top: 22px;
}
.desk-well-head {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--rule);
  border-top: 2px solid var(--rule);
  padding: 8px 0 4px;
  margin: 0 0 4px;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 28px;
  align-items: stretch;
  padding-top: 0;
}

.grid-story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: start;
  padding: 18px 0;
  border-bottom: 1px solid var(--hairline);
  min-height: 0;
}
.grid-story .story-copy { min-width: 0; }
.grid-story .story-hed { font-size: 1.12rem; margin: 6px 0 8px; }
.grid-story .dek {
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.grid-story:hover .story-hed { color: var(--link); }
.desk-well:last-child .grid-story:last-child { border-bottom: 0; }
.grid-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: transparent;
}

.story-page {
  max-width: 720px;
  margin: 28px auto 0;
}
.story-back {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 18px;
  color: var(--link);
}
.story-headline {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.08;
  margin: 10px 0 12px;
}
.story-byline {
  display: flex;
  gap: 16px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 10px 0;
  margin-bottom: 18px;
}
.story-figure {
  position: relative;
  margin: 0 0 18px;
  overflow: hidden;
}
.story-figure img {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  background: #ece8de;
}
.story-intro {
  font-size: 1.2rem;
  line-height: 1.55;
  margin: 0 0 16px;
}
.story-more {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  mask-image: linear-gradient(#000 30%, transparent);
  -webkit-mask-image: linear-gradient(#000 30%, transparent);
}

.paper-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 36px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.paper-footer-links { display: flex; gap: 16px; }
.paper-footer a { color: var(--ink); }

@media (max-width: 900px) {
  .paper { padding: 8px 16px 40px; }
  .paper-masthead {
    white-space: normal;
    font-size: clamp(1.85rem, 8.4vw, 2.35rem);
    line-height: 0.95;
    letter-spacing: 0.01em;
  }
  .paper-utility,
  .paper-dateline {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .paper-utility-mid,
  .paper-dateline > :nth-child(2) { display: none; }
  .paper-utility a { white-space: nowrap; }
  .lead-row,
  .story-grid {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
  .whats-news {
    grid-template-columns: 1fr 1fr;
    column-gap: 16px;
  }
  .strip-story {
    border-right: 0;
    padding-right: 0;
    border-bottom: 1px solid var(--hairline);
  }
  .lead-photo { height: 210px; }
  .rail {
    border-left: 0;
    padding-left: 0;
    border-top: 1px solid var(--hairline);
  }
  .grid-story {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .photo-frame--thumb {
    width: 96px;
    height: 68px;
  }
  .desk-well .kicker { display: none; }
  .paper-sections {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    justify-content: stretch;
    overflow: visible;
  }
  .paper-sections a { display: none; }
  .paper-sections button {
    grid-column: span 2;
    flex: none;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    text-align: center;
    padding: 12px 4px;
    font-size: 11px;
    letter-spacing: 0.08em;
    margin-bottom: 0;
    border-bottom: 1px solid var(--hairline);
  }
  .paper-sections button:nth-child(n+4) {
    grid-column: span 3;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
  }
  .paper-sections button.is-active {
    border-bottom-color: var(--rule);
    border-bottom-width: 2px;
  }
  .paper-footer { flex-direction: column; align-items: flex-start; }
  .story-hed,
  .story-headline,
  .dek,
  .story-intro {
    overflow-wrap: break-word;
  }
}

@media (max-width: 720px) {
  .paper {
    padding:
      max(8px, env(safe-area-inset-top, 0px))
      max(14px, env(safe-area-inset-right, 0px))
      calc(28px + env(safe-area-inset-bottom, 0px))
      max(14px, env(safe-area-inset-left, 0px));
    box-shadow: none;
  }
  .paper-masthead {
    white-space: normal;
    font-size: clamp(1.65rem, 8vw, 2.15rem);
    line-height: 0.94;
  }
  .paper-dateline {
    font-size: 10px;
    letter-spacing: 0.04em;
  }
  .paper-sections button {
    letter-spacing: 0.05em;
  }
  .lead-photo {
    height: auto;
    max-height: 220px;
    aspect-ratio: 16 / 10;
  }
  .lead-story .story-hed { font-size: 1.55rem; }
  .lead-story .dek {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .whats-news {
    grid-template-columns: 1fr;
    column-gap: 0;
    padding: 10px 0 4px;
    border-bottom: 0;
  }
  .strip-story {
    padding: 12px 0;
  }
  .strip-story:last-child { border-bottom: 0; }
  .grid-story {
    column-gap: 10px;
    padding: 14px 0;
  }
  .photo-frame--thumb {
    width: 84px;
    height: 64px;
  }
  .photo-stamp {
    right: 8px;
    bottom: 8px;
    font-size: 16px;
  }
  .grid-story .story-hed { font-size: 1.05rem; }
  .story-headline { font-size: 1.65rem; }
  .story-intro { font-size: 1.08rem; }
  .story-figure img { max-height: 240px; }
  .story-byline {
    flex-wrap: wrap;
    gap: 6px 12px;
  }
  .story-back {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .paper-footer-links {
    flex-wrap: wrap;
    gap: 10px 14px;
  }
}

@media (max-width: 900px) and (max-height: 500px) {
  .paper-masthead {
    font-size: 1.45rem;
    margin: 4px 0;
  }
  .paper-utility { padding: 4px 0 6px; }
  .paper-dateline { padding: 6px 0; }
  .lead-photo {
    height: 132px;
    max-height: 132px;
    aspect-ratio: auto;
  }
  .paper-sections {
    display: flex;
    flex-wrap: nowrap;
    justify-content: stretch;
  }
  .paper-sections button,
  .paper-sections button:nth-child(n+4) {
    grid-column: auto;
    flex: 1 1 0;
    width: auto;
    min-height: 36px;
    padding: 8px 4px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
  }
}
