@font-face {
  font-family: "Noto Sans Sinhala";
  src: url("/assets/noto-sans-sinhala.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  unicode-range: U+0964-0965, U+0D81-0DF4, U+1CF2, U+200C-200D, U+25CC, U+111E1-111F4;
}

:root {
  --hub-paper: var(--surface, #fff);
  --hub-ivory: var(--light, #f8f4e9);
  --hub-rule: var(--gold-line, #e3d5b8);
  --hub-gold: var(--gold, #8a6529);
  --hub-gold-wash: #f7efdd;
  --hub-sinhala: "Noto Sans Sinhala", "Sinhala Sangam MN", "Nirmala UI", "Iskoola Pota", sans-serif;
  --hub-reading-width: 72ch;
}

.hub-intro,
.article-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-bottom: 1px solid var(--hub-rule);
  background: radial-gradient(ellipse at 95% 10%, var(--ice), transparent 62%),
    linear-gradient(105deg, var(--hub-paper) 28%, var(--hub-ivory) 76%, var(--lilac));
}

.hub-intro::after,
.article-header::after {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 48%;
  background-image: var(--technical-grid);
  background-size: var(--grid-size);
  mask-image: linear-gradient(90deg, transparent 5%, #000 100%);
  content: "";
  pointer-events: none;
}

.hub-intro-inner {
  padding-block: clamp(49px, 8vw, 108px);
}

.hub-intro .eyebrow,
.article-kicker {
  color: var(--hub-gold);
}

.hub-intro h1,
.article-heading h1,
.article-related h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -.025em;
  overflow-wrap: break-word;
}

.hub-intro h1 {
  margin-block: 9px 17px;
  font-size: clamp(3.6rem, 9vw, 8rem);
  line-height: .94;
  text-transform: uppercase;
}

.hub-lede {
  max-width: 57ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.65vw, 1.2rem);
  line-height: 1.6;
}

.hub-archive {
  padding-block: clamp(32px, 5.6vw, 74px) clamp(58px, 8vw, 106px);
  background: linear-gradient(145deg, var(--hub-ivory) 42%, #f1f8fb);
}

.hub-controls {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(12rem, 1fr);
  align-items: end;
  gap: 15px clamp(16px, 3vw, 34px);
  padding: clamp(16px, 2.5vw, 28px);
  border: 1px solid var(--hub-rule);
  border-radius: 6px;
  background: var(--hub-paper);
}

.hub-control-search,
.hub-control-topic {
  display: grid;
  align-items: end;
  gap: 6px 8px;
  min-width: 0;
}

.hub-control-search {
  grid-template-columns: minmax(0, 1fr) auto;
}

.hub-control-search > label {
  grid-column: 1 / -1;
}

.hub-controls label {
  color: var(--ink);
  font-size: .88rem;
  font-weight: 700;
}

.hub-controls label:has(input, select) {
  display: grid;
  gap: 6px;
}

.hub-control-search:has(> label input) > label {
  grid-column: auto;
}

.hub-controls input,
.hub-controls select {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid #b5a693;
  border-radius: 4px;
  background: var(--hub-paper);
  color: var(--ink);
  font: inherit;
}

.hub-controls input {
  font-family: Inter, "Noto Sans Sinhala", system-ui, sans-serif;
}

.hub-controls select {
  appearance: none;
  padding-right: 36px;
  background:
    linear-gradient(45deg, transparent 48%, var(--hub-gold) 51%, var(--hub-gold) 65%, transparent 67%) right 17px center / 6px 7px no-repeat,
    linear-gradient(-45deg, transparent 48%, var(--hub-gold) 51%, var(--hub-gold) 65%, transparent 67%) right 12px center / 6px 7px no-repeat,
    var(--hub-paper);
}

.hub-controls input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.hub-controls .button {
  min-height: 48px;
}

.hub-intro :focus-visible,
.hub-archive :focus-visible,
.article-header :focus-visible,
.article-shell :focus-visible,
.article-related :focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

.hub-status {
  min-height: 1.5em;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(15px, 2vw, 26px);
}

.hub-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border: 1px solid var(--hub-rule);
  border-radius: 5px 5px 15px 5px;
  background: var(--hub-paper);
  box-shadow: var(--panel-shadow);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.hub-card:hover,
.hub-card:focus-within {
  border-color: var(--teal);
  box-shadow: 0 10px 24px #12596c19;
}

.hub-card-image {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--hub-rule);
  border-radius: 5px 5px 0 0;
  background: radial-gradient(ellipse at 70% 63%, var(--hub-paper), var(--ice));
}

.hub-card-image:focus-visible {
  z-index: 1;
  outline-offset: 2px;
}

.hub-card-image img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  transition: transform .25s ease;
}

.hub-card:hover .hub-card-image img {
  transform: scale(1.035);
}

.hub-card-body {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: start;
  padding: clamp(17px, 2.15vw, 27px);
}

.hub-card-meta,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 10px;
  color: var(--muted);
  font-size: .82rem;
}

.hub-card-meta {
  margin-bottom: 9px;
  font-weight: 600;
}

.hub-card-meta time {
  white-space: nowrap;
}

.hub-card-meta :where(a, span),
.article-kicker {
  color: var(--hub-gold);
  font-weight: 700;
}

.hub-card h2,
.article-related .hub-card h3 {
  max-width: 32ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.77rem, 2.55vw, 2.35rem);
  font-weight: 700;
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.hub-card :where(h2, h3) a:hover,
.article-back:hover,
.article-kicker a:hover {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: .12em;
}

.hub-card-excerpt {
  margin-top: 10px;
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.hub-card-body > .text-link {
  margin-top: auto;
  padding-top: 15px;
  color: var(--red);
}

.hub-empty {
  grid-column: 1 / -1;
  padding: clamp(21px, 4vw, 45px);
  border: 1px solid var(--hub-rule);
  border-radius: 6px;
  background: var(--hub-paper);
  color: var(--muted);
}

.hub-empty :where(a, button) {
  margin-top: 10px;
}

.article-heading {
  max-width: min(100%, 1070px);
  padding-block: clamp(29px, 5.8vw, 73px) clamp(31px, 5.4vw, 69px);
}

.article-back {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: clamp(16px, 3.4vw, 33px);
  color: var(--ink);
  font-size: .9rem;
  font-weight: 700;
}

.article-kicker {
  display: block;
  margin-bottom: 9px;
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.article-heading h1 {
  max-width: 26ch;
  margin: 0;
  font-size: clamp(2.82rem, 6.25vw, 5.7rem);
  line-height: .98;
}

.article-meta {
  column-gap: 12px;
  margin-top: 19px;
  font-size: .94rem;
}

.article-meta time {
  white-space: nowrap;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 15px 0 0;
  padding: 0;
  list-style: none;
}

.article-tags > :is(a, li, span) {
  padding: 3px 9px;
  border: 1px solid var(--hub-rule);
  border-radius: 3px;
  background: var(--hub-paper);
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.35;
}

.article-tags a:hover {
  color: var(--red);
  text-decoration: underline;
  text-underline-offset: 3px;
}

main:has(.article-shell) {
  background: var(--hub-paper);
}

.article-shell {
  padding-block: clamp(22px, 4.2vw, 57px) clamp(55px, 8vw, 95px);
}

.article-cover {
  width: min(100%, 1024px);
  margin: 0 auto clamp(26px, 5vw, 54px);
  overflow: hidden;
  border: 1px solid var(--hub-rule);
  border-radius: 6px;
  background: var(--hub-ivory);
}

.article-cover img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(70svh, 620px);
  object-fit: contain;
}

.article-body {
  width: min(100%, var(--hub-reading-width));
  margin-inline: auto;
  color: var(--ink);
  font-size: clamp(1.03rem, 1.4vw, 1.125rem);
  line-height: 1.77;
  overflow-wrap: anywhere;
}

.article-shell:not(.wrap) > :is(.article-cover, .article-body) {
  max-width: calc(100% - var(--gutter) * 2);
}

.article-body > * + * {
  margin-block-start: 1.18em;
}

.article-body :is(h1, h2, h3, h4, h5, h6) {
  margin-block: 1.52em .5em;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  line-height: 1.08;
  text-wrap: pretty;
}

.article-body :is(h1, h2) { font-size: clamp(1.96rem, 3.5vw, 2.72rem); }
.article-body h3 { font-size: clamp(1.57rem, 2.8vw, 2.12rem); }
.article-body :is(h4, h5, h6) { font-size: clamp(1.23rem, 2.3vw, 1.52rem); }
.article-body > :first-child { margin-block-start: 0; }
.article-body > :is(h1, h2, h3, h4, h5, h6) + * { margin-block-start: .52em; }

.article-body ul,
.article-body ol {
  padding-inline-start: 1.45em;
}

.article-body li + li { margin-top: .37em; }
.article-body li :is(ul, ol) { margin-block: .38em .2em; }

.article-body a {
  color: var(--red);
  text-decoration: underline;
  text-decoration-thickness: .08em;
  text-underline-offset: .16em;
}

.article-body a:hover { color: var(--ink); }

.article-body hr {
  height: 1px;
  margin-block: 2em;
  border: 0;
  background: var(--hub-rule);
}

.article-body img {
  max-width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: 4px;
}

.article-body figure {
  max-width: 100%;
  margin-block: 1.7em;
}

.article-body figcaption {
  margin-top: 9px;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.5;
  text-align: center;
}

.article-media-unavailable {
  padding: 15px 19px;
  border: 1px solid var(--hub-rule);
  border-radius: 4px;
  background: var(--hub-ivory);
  color: var(--muted);
  font-size: .9rem;
  text-align: center;
}

.article-body blockquote {
  margin-inline: 0;
  padding: .8em 1em;
  border-inline-start: 3px solid var(--hub-gold);
  background: var(--hub-ivory);
}

.article-body :is(.wp-block-columns, .wp-block-gallery) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  align-items: start;
  gap: .8rem;
}

.article-body .wp-block-gallery figure {
  margin: 0;
}

.article-body :is(.wp-block-table, .article-table) {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--hub-rule);
  border-radius: 4px;
}

.article-body table {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: .91rem;
  line-height: 1.45;
}

.article-body :is(th, td) {
  padding: 9px 12px;
  border-bottom: 1px solid var(--hub-rule);
  text-align: start;
  vertical-align: top;
}

.article-body th { background: var(--hub-gold-wash); }
.article-body tbody tr:nth-child(even) { background: var(--hub-ivory); }
.article-body tbody tr:last-child td { border-bottom: 0; }

.article-related {
  padding-block: clamp(40px, 6.6vw, 81px);
  border-top: 1px solid var(--hub-rule);
  background: var(--hub-ivory);
}

.article-related :is(.wrap, .article-related-inner) > h2 {
  margin: 0 0 18px;
  font-size: clamp(2.45rem, 5vw, 4.4rem);
  line-height: .98;
  text-transform: uppercase;
}

.hub-card :lang(si),
.article-heading :lang(si),
.article-body:lang(si),
.article-body :lang(si) {
  font-family: var(--hub-sinhala);
  letter-spacing: normal;
  line-height: 1.6;
}

.article-heading h1:lang(si) {
  max-width: none;
  font-size: clamp(2.05rem, 5.6vw, 4rem);
  line-height: 1.32;
}

.hub-card :is(h2, h3) a:lang(si) {
  max-width: none;
  font-size: clamp(1.35rem, 2.03vw, 1.78rem);
  line-height: 1.45;
}

@media (max-width: 920px) {
  .hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .hub-controls { grid-template-columns: 1fr; }
  .hub-intro::after, .article-header::after { opacity: .65; }
  .hub-card-body { padding: 17px; }
}

@media (max-width: 540px) {
  .hub-grid { grid-template-columns: minmax(0, 1fr); }
  .article-heading h1 { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-card,
  .hub-card-image img { transition: none; }
  .hub-card:hover .hub-card-image img { transform: none; }
}
