/* ==========================================================================
   Hinterlander: Evening edition
   Built from the Hinterlander design mockup (rolled-newspaper mark, warm ground,
   Dispatch / Comment / The Long View).
   Styles both page types the generator produces:
     - front page:  .main_body > .column[name=Left|Middle|Right] > .article_section
     - region page: .main_body > .article
   No external fonts, images or scripts. The logo is an inline SVG in this file.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */
:root {
  --ground: #efe9e0;
  --ink:    #1a1815;
  --mid:    #524d45;
  --faint:  #877f73;
  --rule:   #d6cdbf;
  --hair:   #e0d8cb;
  --accent: #8a4b2a;

  --serif: "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 70 46'%3E%3Cg transform='rotate%28-13 35 23%29' fill='none' stroke='%23000' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='M15 7h43a9 16 0 0 1 0 32H15'/%3E%3Cellipse cx='15' cy='23' rx='9' ry='16'/%3E%3Cellipse cx='16.5' cy='23' rx='5' ry='9'/%3E%3Ccircle cx='18' cy='23' r='1.7'/%3E%3Cpath d='M31 14h21' stroke-width='2.8'/%3E%3Cpath d='M31 22h23' stroke-width='1.2'/%3E%3Cpath d='M31 28h18' stroke-width='1.2'/%3E%3C/g%3E%3C/svg%3E");
}

/* --- Base (set explicitly: the pages render without a doctype) ----------- */
*, *::before, *::after { box-sizing: border-box; }

html { background: var(--ground); }

body {
  margin: 0 auto;
  max-width: 1400px;
  padding: 0 40px 90px;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;

  /* Header row: masthead left, edition block right, columns below */
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

/* The generator spaces blocks with <br> and a stray <p>; spacing lives here */
body > br,
body > p,
.main_body br { display: none; }

/* --- Masthead: mark + wordmark + tagline --------------------------------- */
.masthead_div {
  grid-column: 1;
  grid-row: 1;
  padding: 30px 0 22px;
  border-bottom: 1px solid var(--ink);
}

.masthead {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}

/* Rolled newspaper. Drawn as a mask so it takes the ink colour of each edition */
.masthead::before {
  content: "";
  flex: 0 0 auto;
  width: 67px;
  height: 44px;
  background-color: currentColor;
  -webkit-mask: var(--logo) center / contain no-repeat;
          mask: var(--logo) center / contain no-repeat;
}

.masthead_div::after {
  content: "One page, fewer solitudes.";
  display: block;
  margin-top: 7px;
  font-size: 13.5px;
  font-style: italic;
  color: var(--faint);
}

/* --- Edition block (top right) ------------------------------------------- */
/* font-size: 0 hides the literal " - " between the region and edition spans */
.banner_div {
  grid-column: 2;
  grid-row: 1;
  align-self: stretch;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 36px 0 22px;
  border-bottom: 1px solid var(--ink);
  font-size: 0;
  text-align: right;
}

.edition_banner,
.category_banner {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--accent);
}

.category_banner::after {
  content: "\00B7";
  margin: 0 0.6em;
}

/* --- Main area ------------------------------------------------------------ */
.main_body { grid-column: 1 / -1; }

/* Front page: Dispatch ?? Comment ?? The Long View.
   The generator emits News (Left) ?? Long Form (Middle) ?? Opinion (Right);
   order puts Long Form last to match the design. */
.main_body:has(> .column) {
  display: grid;
  grid-template-columns: 1.08fr 1fr 1fr;
  align-items: start;
}

.column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 30px;
  border-right: 1px solid var(--hair);
}

.column[name='Left']   { order: 1; padding-left: 0; }
.column[name='Right']  { order: 2; }
.column[name='Middle'] { order: 3; padding-right: 0; border-right: 0; }

/* Dispatch carries most of the volume. Comment and The Long View stay in view
   and scroll on their own, so the page doesn't go blank beside a long Dispatch. */
.column[name='Right'],
.column[name='Middle'] {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}

/* --- Column heads --------------------------------------------------------- */
/* Built from pseudo-elements: small "The" label, column name, one-line
   description. The generator's own title text is hidden. */
.column_title {
  order: 0;
  margin-top: 30px;
  font-size: 0;
  line-height: 1;
}

.column_title::before {
  content: "\00A0";
  display: block;
  height: 16px;
  margin-bottom: 5px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.column[name='Middle'] > .column_title::before { content: "The"; }

.column_title::after {
  display: block;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--ink);
}
.column[name='Left']   > .column_title::after { content: "Dispatch"; }
.column[name='Right']  > .column_title::after { content: "Comment"; }
.column[name='Middle'] > .column_title::after { content: "Long View"; }

.column::after {
  order: 1;
  display: block;
  margin: 7px 0 6px;
  padding-bottom: 9px;
  border-bottom: 2px solid var(--ink);
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--faint);
}
.column[name='Left']::after   { content: "The day\2019s reporting"; }
.column[name='Right']::after  { content: "Argument with a short arc"; }
.column[name='Middle']::after { content: "Still worth reading in six months"; }

.column > .article_section { order: 2; }

/* --- Region pages: single reading column --------------------------------- */
.main_body:not(:has(> .column)) {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding-top: 14px;
}

/* --- Article cards -------------------------------------------------------- */
/* Source order is: source, date, title, summary.
   Grid re-sequences it to: title / source ... time / summary. */
.article,
.article_section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  padding: 19px 0;
  border-bottom: 1px solid var(--hair);
}

.article:last-child,
.article_section:last-child { border-bottom: 0; }

.article_link     { order: 1; grid-column: 1 / -1; margin-bottom: 7px; }
.publication_name { order: 2; grid-column: 1; }
.article_pub_date { order: 3; grid-column: 2; }
.article_summary  { order: 4; grid-column: 1 / -1; }

/* Headline */
.article_link { color: var(--ink); text-decoration: none; }

.article_title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.005em;
  text-wrap: pretty;
}

.article_link:hover .article_title {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--faint);
}

.article_link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Meta line: source (left) ... time (right) */
.publication_name,
.article_pub_date {
  margin-bottom: 7px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.publication_name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.article_pub_date {
  padding-left: 10px;
  color: var(--faint);
  white-space: nowrap;
  text-align: right;
}

/* Summary (dek): two lines */
.article_summary {
  margin: 0;
  font-family: var(--serif);
  font-size: 14px;
  line-height: 1.5;
  color: var(--mid);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}

/* Feed cruft inside summaries */
.article_summary p { display: inline; margin: 0; }
.article_summary p + p,              /* "The post ... appeared first on ..." */
.article_summary figure,
.article_summary img { display: none; }
.article_summary blockquote { display: inline; margin: 0; }
.article_summary a,
.article_summary u { color: inherit; text-decoration: none; pointer-events: none; }

/* --- Lead story: top of Dispatch, and top of a region page ---------------- */
.column[name='Left'] > .article_section:first-of-type,
.main_body:not(:has(> .column)) > .article:first-child {
  padding: 24px 0;
}

.column[name='Left'] > .article_section:first-of-type .article_title,
.main_body:not(:has(> .column)) > .article:first-child .article_title {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.16;
}

.column[name='Left'] > .article_section:first-of-type .article_link,
.main_body:not(:has(> .column)) > .article:first-child .article_link {
  margin-bottom: 10px;
}

.column[name='Left'] > .article_section:first-of-type .article_summary,
.main_body:not(:has(> .column)) > .article:first-child .article_summary {
  font-size: 15.5px;
  color: var(--ink);
  opacity: 0.78;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* --- The Long View reads slower ------------------------------------------- */
.column[name='Middle'] > .article_section { padding: 26px 0; }

.column[name='Middle'] .article_title {
  font-size: 18.5px;
  line-height: 1.38;
}

.column[name='Middle'] .article_link { margin-bottom: 9px; }

.column[name='Middle'] .article_summary {
  line-height: 1.58;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* --- Region page sizes ---------------------------------------------------- */
.main_body:not(:has(> .column)) > .article { padding: 21px 0; }
.main_body:not(:has(> .column)) > .article:not(:first-child) .article_title { font-size: 19px; }
.main_body:not(:has(> .column)) .article_summary { font-size: 14.5px; }

/* --- Medium screens: Dispatch + Comment side by side, Long View below ---- */
@media (max-width: 1080px) {
  .main_body:has(> .column) { grid-template-columns: 1fr 1fr; }

  .column[name='Right'] { padding-right: 0; border-right: 0; }

  .column[name='Middle'] {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    margin-top: 10px;
    border-top: 1px solid var(--hair);
  }
}

/* --- Small screens: one column, header stacks ---------------------------- */
/* Phones only reach this once the pages include
   <meta name="viewport" content="width=device-width, initial-scale=1">. */
@media (max-width: 720px) {
  body {
    padding: 0 20px 60px;
    grid-template-columns: 1fr;
  }

  .masthead_div { border-bottom: 0; padding-bottom: 10px; }
  .banner_div {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
    padding: 0 0 16px;
    text-align: left;
  }

  .masthead { font-size: 31px; }

  .main_body:has(> .column) { display: block; }

  .column,
  .column[name='Right'],
  .column[name='Middle'] {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 0;
    margin: 0;
    border: 0;
  }

  .column[name='Left'] > .article_section:first-of-type .article_title,
  .main_body:not(:has(> .column)) > .article:first-child .article_title { font-size: 23px; }
}

/* --- Print ----------------------------------------------------------------- */
@media print {
  html, body { background: #fff; }
  .column[name='Right'], .column[name='Middle'] {
    position: static; max-height: none; overflow: visible;
  }
}
