/* ============================================================
   EINKNEWS — E-Ink Morning Newspaper
   Designed for Boox Go 10.3 (2480×1860, 300ppi, monochrome)
   No scrolling. Edge taps navigate pages.
   ============================================================ */

/* --- FONTS -------------------------------------------------- */

/* DN Serif — variable font, weight 100–600, used for all headings */
@font-face {
  font-family: 'DNSerif';
  src: url('../fonts/DNSerif-Variable.woff2') format('woff2'),
       url('../fonts/DNSerif-Variable.ttf') format('truetype');
  font-weight: 100 600;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'LibreBaskerville';
  src: url('../fonts/LibreBaskerville-Regular.woff2') format('woff2'),
       url('../fonts/LibreBaskerville-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'LibreBaskerville';
  src: url('../fonts/LibreBaskerville-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'LibreBaskerville';
  src: url('../fonts/LibreBaskerville-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: block;
}

/* --- VARIABLES ---------------------------------------------- */

:root {
  --page-margin: clamp(40px, 5vmin, 96px);
}

/* --- RESET & BASE ------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #fff;
  color: #000;
  font-family: 'LibreBaskerville', 'Georgia', 'Times New Roman', serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Prevent double-tap zoom on e-ink */
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- TAP ZONES (created by JS, defined here) --------------- */

.tap-zone {
  position: fixed;
  top: 0;
  height: 100vh;
  width: 1.5cm;
  z-index: 100;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tap-zone-left  { left: 0; }
.tap-zone-right { right: 0; }

/* --- PAGE INDICATOR ----------------------------------------- */

.page-indicator {
  position: fixed;
  bottom: 1.5vh;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(10px, 0.8vw, 14px);
  color: #888;
  letter-spacing: 0.1em;
  font-family: 'LibreBaskerville', serif;
  font-style: italic;
  pointer-events: none;
  z-index: 50;
  background: #fff;
  padding: 5px;
}

/* --- STALE BANNER ------------------------------------------- */

.stale-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  font-size: clamp(10px, 0.7vw, 12px);
  padding: 3px 16px;
  z-index: 200;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================================================
   FRONT PAGE
   ============================================================ */

.front-container {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Horizontal strip of pages */
.front-slider {
  display: flex;
  width: calc(var(--page-count, 1) * 100vw);
  height: 100vh;
  will-change: transform;
  /* Instant transition for e-ink — no intermediate frames */
  transition: transform 0s;
}

/* Single page grid: 2 cols × 3 rows = 6 cards (portrait-optimised) */
.front-page {
  width: 100vw;
  height: 100vh;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  background: #ddd; /* gap colour — grid lines */
  padding: 0;
}

/* --- Masthead (first page only) --- */

.front-page:first-child .article-card:first-child {
  /* Could add a top masthead bar — using a pseudo-element */
}

/* --- Article Card --- */

.article-card {
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 1.5vmin, 24px) clamp(16px, 2vmin, 28px);
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* Tap area must not overlap nav zones */
  position: relative;
}

.card-source {
  font-size: 15px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 10px;
  font-style: normal;
}

.card-section {
  position: absolute;
  top: clamp(8px, 1vmin, 16px);
  right: clamp(8px, 1vmin, 16px);
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: 'LibreBaskerville', serif;
  font-style: normal;
  color: #000;
  padding: 2px 6px;
  line-height: 1.4;
}

.card-headline {
  font-family: 'DNSerif', 'Georgia', serif;
  font-size: clamp(20px, 3.2vmin, 52px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin-bottom: clamp(8px, 1vmin, 14px);
  /* Clamp to 5 lines to prevent overflow */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}

.card-teaser {
  font-size: clamp(15px, 2.1vmin, 32px);
  line-height: 1.5;
  color: #333;
  /* Clamp to 4 lines */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
}

/* Empty state */
.front-page--empty {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.empty-message {
  text-align: center;
  padding: 4vw;
}

.empty-message h2 {
  font-family: 'DNSerif', 'Georgia', serif;
  font-size: clamp(20px, 2vw, 36px);
  margin-bottom: 1em;
}

.empty-message p {
  font-size: clamp(14px, 1.2vw, 20px);
  color: #555;
}

/* ============================================================
   ARTICLE PAGE
   ============================================================ */

.article-container {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Article header — flows inside the two columns */
.article-header {
  margin-bottom: clamp(6px, 0.8vmin, 12px);
}

.article-source {
  font-size: clamp(9px, 1vmin, 12px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: clamp(4px, 0.5vmin, 8px);
}

.article-headline {
  font-family: 'DNSerif', 'Georgia', serif;
  font-size: clamp(28px, 4.5vmin, 66px);
  font-weight: 500;
  font-style: italic;
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin-bottom: clamp(8px, 1vmin, 16px);
}

.article-preamble {
  font-family: 'LibreBaskerville', 'Georgia', serif;
  font-size: clamp(16px, 2.2vmin, 28px);
  line-height: 1.38;
  font-weight: 700;
  color: #000;
  font-style: normal;
  margin-bottom: clamp(6px, 0.7vmin, 10px);
}

.article-byline {
  font-size: clamp(13px, 1.5vmin, 20px);
  color: #555;
  font-style: italic;
  margin-bottom: clamp(10px, 1.2vh, 20px);
  padding-bottom: clamp(8px, 1vh, 16px);
  border-bottom: 1px solid #ccc;
}

/* All content in one element; CSS columns flow horizontally into as many
   two-column "pages" as needed. JS measures and navigates by translating.
   Math: margin-left = M, column-gap = M → each 100vw page has M margin
   on both sides and M/2 effective gap in the middle. */
/* Height is 96vh so each virtual "page" has 4vh clear at the bottom
   for the page indicator. padding-top applies only on page 1 naturally. */
.article-body {
  height: calc(100vh - 4vh);
  width: calc(20000vw - 2 * var(--page-margin));
  margin-left: var(--page-margin);
  padding-top: var(--page-margin);
  column-width: calc((100vw - 3 * var(--page-margin)) / 2);
  column-gap: var(--page-margin);
  column-fill: auto;
  will-change: transform;
  transition: transform 0s;
}

/* --- Article Body Typography --- */

.article-body p {
  font-size: clamp(14px, 1.8vmin, 23px);
  line-height: 1.7;
  margin-bottom: 0.9em;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  orphans: 3;
  widows: 3;
}

.article-body h2,
.article-body h3 {
  font-family: 'DNSerif', 'Georgia', serif;
  font-size: clamp(16px, 2vmin, 29px);
  font-weight: 600;
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  line-height: 1.2;
}

.article-body strong {
  font-weight: 700;
}

.article-body em {
  font-style: italic;
}

.article-body ul {
  margin: 0.8em 0 0.8em 1.5em;
}

.article-body li {
  font-size: clamp(14px, 1.8vmin, 23px);
  line-height: 1.65;
  margin-bottom: 0.4em;
}

/* --- Images in article body --- */

figure.article-image {
  width: 100%;
  margin: 1em 0 0;
}

figure.article-image img {
  width: 100%;
  max-height: 33vh;
  object-fit: cover;
  display: block;
  /* Optimise for monochrome e-ink */
  filter: grayscale(100%) contrast(1.02) brightness(1.3);
}

figure.article-image figcaption {
  font-size: clamp(13px, 1.5vmin, 20px);
  color: #444;
  font-style: normal;
  margin-top: 0.4em;
  line-height: 1.4;
  padding-bottom: 0.6em;
}


/* ============================================================
   PRINT-STYLE DECORATIVE ELEMENTS
   ============================================================ */

/* Thin rule above article cards on second+ page */
.front-page:not(:first-child) .article-card::before {
  /* intentionally empty — grid lines serve as separators */
}

