/* Today -- a modern colour newspaper. Body type is Noticia Text (SIL OFL);
   drop NoticiaText-Regular/-Italic/-Bold/-BoldItalic.ttf into static/fonts/
   and they are picked up below. Georgia is the fallback until then. */
@font-face { font-family: 'Noticia Text'; font-weight: 400; font-style: normal; font-display: swap;
  src: local('Noticia Text'), local('NoticiaText-Regular'), url("../fonts/NoticiaText-Regular.ttf") format("truetype"); }
@font-face { font-family: 'Noticia Text'; font-weight: 400; font-style: italic; font-display: swap;
  src: local('Noticia Text Italic'), local('NoticiaText-Italic'), url("../fonts/NoticiaText-Italic.ttf") format("truetype"); }
@font-face { font-family: 'Noticia Text'; font-weight: 700; font-style: normal; font-display: swap;
  src: local('Noticia Text Bold'), local('NoticiaText-Bold'), url("../fonts/NoticiaText-Bold.ttf") format("truetype"); }
@font-face { font-family: 'Noticia Text'; font-weight: 700; font-style: italic; font-display: swap;
  src: local('Noticia Text Bold Italic'), local('NoticiaText-BoldItalic'), url("../fonts/NoticiaText-BoldItalic.ttf") format("truetype"); }

:root {
  --paper-color: #fbfbf9;
  --paper-image: url("../img/paper.png");
  --ink: #16161a;
  --ink-soft: #5b5b63;
  --rule: #16161a;
  --rule-light: #d9d8d3;
  --accent: #c8102e;
  --td-serif: "Noticia Text", Georgia, "Times New Roman", Times, serif;
  --td-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tb-sidebar-bg: var(--paper-color);
  /* Today is a colour paper: images keep their own colours. */
  --tb-img-filter: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--td-serif);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper-color) var(--paper-image) repeat;
  min-height: 100vh;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }

.page { min-height: 100vh; }
.wrap { max-width: var(--opt-page-width, 1400px); margin: 0 auto; padding: 0.75rem 1.5rem 2rem; }
.area-main, .area-main-view, .area-sidebar, .area-header, .area-footer { background: transparent; }

/* ---- Masthead ---------------------------------------------------- */
.area-header { margin-bottom: 1.25rem; border-top: 6px solid var(--rule); border-bottom: 1px solid var(--rule); }
.area-header .tb-header-inner { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--ink); padding: 0.4rem 0; }
.area-header h1 {
  margin: 0;
  font-family: var(--td-serif);
  font-weight: 700;
  font-size: clamp(3rem, 11vw, 8rem);
  line-height: 1;
  letter-spacing: -0.035em;
}
.area-header h1::after { content: "."; color: var(--accent); }
.td-kicker {
  margin: 0 0 0.2rem;
  font-family: var(--td-sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---- Columns: Sections | stories | Most read --------------------- */
.page-columns { display: flex; gap: 2rem; align-items: flex-start; width: 100%; }
.area-sidebar.sidebar-left  { flex: 0 0 var(--tb-sidebar-left-w, 180px); padding-right: 1.5rem; border-right: 1px solid var(--rule-light); }
.area-sidebar.sidebar-right { flex: 0 0 var(--tb-sidebar-right-w, 290px); padding-left: 1.5rem; border-left: 1px solid var(--rule-light); }
.area-main, .area-main-view { flex: 1 1 auto; min-width: var(--tb-main-min-w, 0); }

.tb-widget { padding: 0; margin-bottom: 1.75rem; }
.area-main > .tb-widget:last-child,
.area-main-view > .tb-widget:last-child,
.area-sidebar > .tb-widget:last-child { margin-bottom: 0; }

.tb-widget-title {
  margin: 0 0 0.8rem;
  padding-top: 0.45rem;
  border-top: 3px solid var(--rule);
  font-family: var(--td-sans);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.area-sidebar .tb-widget-title { border-top-color: var(--accent); }

/* ---- Sections (tags) and archive --------------------------------- */
.area-sidebar { font-family: var(--td-sans); font-size: 0.9rem; }
.tb-tag-list { display: flex; flex-direction: column; gap: 0.35rem; }
.tb-tag-chip { border-radius: 2px !important; font-weight: 600; }
.tb-archive-year { margin-bottom: 0.6rem; }
.tb-archive-year > summary { cursor: pointer; font-weight: 700; border-bottom: 1px solid var(--rule-light); padding-bottom: 0.15rem; }
.tb-archive-month { margin: 0.35rem 0 0.35rem 0.7rem; }
.tb-archive-month summary { cursor: pointer; color: var(--ink-soft); }
.tb-archive-month ul, .tb-archive-group ul { list-style: none; margin: 0.3rem 0 0; padding: 0; }
.tb-archive-month li, .tb-archive-group li { margin-bottom: 0.3rem; line-height: 1.3; }
.tb-archive-month li a, .tb-archive-group li a { text-decoration: none; }
.tb-archive-month li a:hover, .tb-archive-group li a:hover { text-decoration: underline; }

/* ---- Post lists -------------------------------------------------- */
.tb-page-list, .tb-featured-posts, .tb-popular-posts { gap: 0; }
.tb-post-card { padding: 1.1rem 0; border-bottom: 1px solid var(--rule-light); }
.tb-post-card:first-child { padding-top: 0; }
.tb-post-card h3 { margin: 0 0 0.25rem; font-size: 1.55rem; line-height: 1.15; letter-spacing: -0.01em; }
.tb-post-card h3 a { text-decoration: none; }
.tb-popular-posts { counter-reset: td-pop; }
.tb-popular-posts .tb-post-card { counter-increment: td-pop; position: relative; padding-left: 2.1rem; }
.tb-popular-posts .tb-post-card::before {
  content: counter(td-pop);
  position: absolute; left: 0; top: 1.05rem;
  font-family: var(--td-sans); font-weight: 800; font-size: 1.6rem; line-height: 1; color: var(--accent);
}
.tb-popular-posts .tb-post-card h3 { font-size: 1.05rem; }
.tb-popular-posts .tb-post-excerpt { display: none; }
.tb-post-date { font-family: var(--td-sans); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.tb-post-excerpt { color: #2c2c32; }
.tb-read-more { font-family: var(--td-sans); font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.tb-filter-banner { border-bottom: 1px solid var(--rule-light); padding-bottom: 0.6rem; font-family: var(--td-sans); }
.area-sidebar .tb-post-card h3 { font-family: var(--td-serif); }
.tb-post-index-title { font-family: var(--td-serif); font-weight: 700; line-height: 1.25; }

/* Pasted content often carries an inline white background; let the paper show. */
:is(.tb-post-full, .tb-post-card, .tb-post-excerpt, .tb-section, .tb-widget-quill) :is(
  [style*="background" i][style*="255, 255, 255" i],
  [style*="background" i][style*="255,255,255" i],
  [style*="background" i][style*="#fff" i],
  [style*="background" i][style*="white" i]
) { background: transparent !important; }

/* ---- Open post --------------------------------------------------- */
.tb-post-full h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2.1rem, 5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.tb-post-full > .tb-post-date { display: block; margin-bottom: 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--rule); }
.tb-section { line-height: 1.6; }
.tb-section:first-of-type { font-size: 1.2em; line-height: 1.45; color: var(--ink-soft); }
.tb-section p { margin: 0 0 0.8em; }
.tb-section h2, .tb-section h3, .tb-section h4 { margin: 0.4em 0 0.4em; line-height: 1.15; }
.tb-section-title { font-family: var(--td-sans); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.12em; border-top: 3px solid var(--rule); padding-top: 0.4rem; }
.tb-section-columns { column-gap: 2rem; column-rule: 1px solid var(--rule-light); }
.tb-section-columns > .tb-col-piece > :first-child { margin-top: 0; }
.tb-section img, .tb-widget img { filter: var(--tb-img-filter, none); }
.tb-section blockquote { margin: 1em 0; padding: 0 0 0 1.1rem; border-left: 4px solid var(--accent); font-size: 1.15em; font-style: italic; }
.tb-figure figcaption { font-family: var(--td-sans); font-size: 0.8rem; color: var(--ink-soft); font-weight: 400; text-align: left; }

.area-footer { margin-top: 2rem; padding: 0.75rem 0 0; border-top: 6px solid var(--rule); text-align: center; font-family: var(--td-sans); font-size: 0.8rem; color: var(--ink-soft); }

/* ---- Narrow screens (same 768px as TBlog's own switch) ----------- */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .page-columns { flex-direction: column; align-items: stretch; }
  .area-sidebar.sidebar-left, .area-sidebar.sidebar-right { border: 0; padding: 0; }
  .area-sidebar.sidebar-below { border-top: 1px solid var(--rule); padding-top: 1rem; }
  .area-sidebar.sidebar-left.sidebar-pullout,
  .area-sidebar.sidebar-right.sidebar-pullout {
    background: var(--paper-color) var(--paper-image) repeat;
    padding: 1rem !important;
    border-right: 1px solid var(--rule);
  }
}
