/* El terceti -- one stylesheet, no framework.
 *
 * The palette is lifted from the 2010 estils/terceti.css so the site still
 * looks like itself: olive #9c9e63 and #4b4b00, the cream #e9e1d8 / #d8d8ad
 * ground, and #931215 for accents. What changes is everything structural --
 * the old 1000px fixed layout with floated flash boxes becomes fluid grid. */

:root {
  --olive: #4b4b00;
  --olive-mid: #7b7c3f;
  --olive-soft: #9c9e63;
  --olive-pale: #d8d8ad;
  --cream: #e9e1d8;
  --cream-pale: #fbf9e6;
  --red: #931215;
  --red-dark: #660c0e;
  --ink: #221f1a;
  --ink-soft: #57514a;
  --paper: #fffdf8;
  --rule: #ded5c8;

  --measure: 34rem;
  --wrap: 60rem;
  --gap: clamp(1rem, 3vw, 2rem);
  --radius: 4px;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 400 clamp(1rem, 0.96rem + 0.2vw, 1.0625rem)/1.65 var(--sans);
  text-underline-offset: 0.15em;
}

img, video { max-width: 100%; height: auto; }

a { color: var(--red); }
a:hover { color: var(--red-dark); }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0; }

.wrap {
  width: min(100% - 2 * var(--gap), var(--wrap));
  margin-inline: auto;
}

/* --- masthead ---------------------------------------------------------- */

.masthead {
  background: var(--paper);
  border-bottom: 3px solid var(--olive-soft);
}

.masthead__inner {
  width: min(100% - 2 * var(--gap), var(--wrap));
  margin-inline: auto;
  padding-block: 1rem;
}

.masthead__brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  width: fit-content;
}

.masthead__logo {
  width: 57px;
  height: 65px;
  border: 1px solid var(--red-dark);
  flex: none;
}

.masthead__words { display: grid; }

.masthead__name {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.masthead__tagline {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-top: 0.35rem;
}

/* --- navigation --------------------------------------------------------
 * One tree for the whole site. The 2010 version needed jQuery to open its
 * accordion, which meant half the site was unreachable without JavaScript;
 * <details> does the same job natively. */

.nav {
  background: linear-gradient(180deg, var(--olive-soft), var(--olive-mid));
  border-top: 1px solid rgb(0 0 0 / 0.12);
}

.nav__list {
  margin-top: 0;
  width: min(100% - 2 * var(--gap), var(--wrap));
  margin-inline: auto;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
}

/* The Menú button exists only where JavaScript can drive it. Without the `js`
   class the button never appears and the list is simply always open -- long on
   a phone, but every page still reachable. */
.nav__toggle { display: none; }

.nav__bars, .nav__bars::before, .nav__bars::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.nav__bars {
  position: relative;
  transition: background-color 0.15s ease;
}

.nav__bars::before, .nav__bars::after {
  content: "";
  position: absolute;
  left: 0;
  transition: transform 0.2s ease;
}
.nav__bars::before { top: -6px; }
.nav__bars::after { top: 6px; }

@media (max-width: 45.999em) {
  .js .nav__toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: min(100% - 2 * var(--gap), var(--wrap));
    margin-inline: auto;
    padding: 0.85rem 0;
    border: 0;
    background: none;
    color: var(--cream-pale);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
  }

  .js .nav__list { display: none; }
  .js .nav--open .nav__list { display: flex; }

  /* Collapsed into an X while the menu is open. */
  .js .nav--open .nav__bars { background: transparent; }
  .js .nav--open .nav__bars::before { transform: translateY(6px) rotate(45deg); }
  .js .nav--open .nav__bars::after { transform: translateY(-6px) rotate(-45deg); }

  .js .nav--open .nav__list { padding-bottom: 0.5rem; }
}

.nav a, .nav summary {
  display: block;
  padding: 0.7rem 0.9rem;
  color: var(--cream-pale);
  text-decoration: none;
  font-size: 0.9375rem;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.nav a:hover, .nav summary:hover {
  background: rgb(255 255 255 / 0.16);
  color: #fff;
}

/* The page you are on, and the section you are in. The section marker is what
   replaced pre-opening the sub-menu: it says where you are without covering
   the page with a panel on every load. */
.nav a[aria-current="page"],
.nav summary.is-current {
  border-bottom-color: var(--red);
  color: #fff;
  font-weight: 600;
}

.nav summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav summary::-webkit-details-marker { display: none; }
.nav summary::after {
  content: "";
  width: 0.4em;
  height: 0.4em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-0.15em) rotate(45deg);
}
.nav details[open] > summary::after { transform: translateY(0.1em) rotate(-135deg); }

.nav details ul {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--olive);
}

@media (min-width: 46em) {
  .nav details { position: relative; }
  .nav details ul {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 5;
    min-width: 14rem;
    box-shadow: 0 6px 18px rgb(0 0 0 / 0.22);
  }
}

@media (max-width: 45.999em) {
  .nav__list { flex-direction: column; }
  .nav details ul a { padding-left: 2rem; }
}

/* --- typography --------------------------------------------------------- */

h1 {
  font-family: var(--serif);
  font-size: clamp(1.65rem, 1.2rem + 2.2vw, 2.35rem);
  line-height: 1.15;
  margin: 2rem 0 1rem;
  color: var(--olive);
}

h2 {
  font-family: var(--serif);
  font-size: 1.375rem;
  line-height: 1.25;
  margin: 2.25rem 0 0.75rem;
  color: var(--olive);
}

.standfirst {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin-block: 0 2rem;
}

main { padding-bottom: 3.5rem; }

/* --- prose: the <dl> the whole site is written in ----------------------- */

.prose { max-width: none; }
.prose p, .prose ul, .prose ol { max-width: var(--measure); }

.prose dl {
  margin: 0 0 1.75rem;
  max-width: var(--measure);
}

.prose dt {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--olive);
  margin-top: 1.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}

.prose dd {
  margin: 0.75rem 0 0;
}

.prose dd p { margin: 0.75rem 0 0; }

.prose > img {
  display: block;
  margin: 1.75rem 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.hero {
  display: block;
  width: 100%;
  max-height: 22rem;
  object-fit: cover;
  object-position: 50% 60%;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

/* --- video: replaces the Flash <object> --------------------------------- */

.video {
  margin: 2rem 0;
  padding: 0.75rem;
  background: var(--olive-pale);
  border: 1px solid var(--olive-soft);
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
}

.video video {
  display: block;
  width: 100%;
  max-width: 40rem;
  background: #000;
  border-radius: 2px;
}

.video figcaption {
  margin-top: 0.6rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--olive);
  text-align: center;
}

@media (min-width: 60em) {
  .prose .video { float: right; margin: 0.5rem 0 1.5rem 2rem; }
}

/* --- scoring table ------------------------------------------------------ */

.table-scroll { overflow-x: auto; margin: 1.5rem 0 2rem; }

.punts {
  border-collapse: collapse;
  min-width: 18rem;
  background: var(--paper);
  font-size: 0.9375rem;
}

.punts caption {
  text-align: left;
  font-weight: 600;
  color: var(--olive);
  padding-bottom: 0.5rem;
}

.punts th, .punts td {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.9rem;
  text-align: left;
}

.punts thead th { background: var(--olive-pale); }
.punts tbody th { font-weight: 500; }
.punts td { text-align: right; font-variant-numeric: tabular-nums; }

/* --- event fitxa -------------------------------------------------------- */

.fitxa {
  margin: 0 0 2rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 38rem;
}

.fitxa__row {
  display: grid;
  grid-template-columns: minmax(7rem, 10rem) 1fr;
  border-top: 1px solid var(--rule);
}
.fitxa__row:first-child { border-top: 0; }

.fitxa dt {
  background: var(--olive-pale);
  color: var(--olive);
  font-weight: 600;
  padding: 0.55rem 0.9rem;
}

.fitxa dd {
  margin: 0;
  padding: 0.55rem 0.9rem;
}

.fitxa__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

@media (max-width: 30em) {
  .fitxa__row { grid-template-columns: 1fr; }
  .fitxa dd { padding-block: 0.4rem; }
}

/* --- galleries ---------------------------------------------------------- */

.gallery__grid {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.5rem;
}

.gallery__item {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease;
}

.gallery__item:hover img { transform: scale(1.06); }

/* --- lightbox (progressive enhancement; site.js) --------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(20 18 12 / 0.92);
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: clamp(0.5rem, 3vw, 2rem);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
}

.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--cream-pale);
  padding-top: 0.75rem;
  font-size: 0.9375rem;
}

.lightbox button {
  font: inherit;
  color: inherit;
  background: rgb(255 255 255 / 0.12);
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: var(--radius);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  min-width: 2.75rem;
}
.lightbox button:hover { background: rgb(255 255 255 / 0.24); }

.lightbox__caption { flex: 1; text-align: center; }

/* --- links list --------------------------------------------------------- */

.links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
  max-width: var(--measure);
}

.links a {
  display: inline-block;
  padding: 0.2rem 0;
}

/* Most of the newspapers cited in 2010 have deleted these articles. Where the
   Internet Archive still has one, say so, so nobody is surprised to land on a
   Wayback page. */
.links__archived {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-style: italic;
}
.links__archived::before { content: "· "; }

/* --- section landing cards ---------------------------------------------- */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.cards__item {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--olive-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  overflow: hidden;
}

/* Illustrated cards: the photo runs to the card's edges, so it cancels the
   padding rather than sitting inset within it. */
.cards__thumb {
  display: block;
  /* max-width:none is load-bearing: the global `img { max-width: 100% }` would
     otherwise cap this back to the content box and leave a gap down the right
     edge of every card. */
  width: calc(100% + 2.5rem);
  max-width: none;
  margin: -1.1rem 0 1rem -1.25rem;
  aspect-ratio: 758 / 400;
  object-fit: cover;
  background: var(--olive-pale);
  transition: transform 0.25s ease;
}

.cards__item:hover .cards__thumb { transform: scale(1.03); }

.cards__item h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.cards__item h2 a { text-decoration: none; color: var(--olive); }
.cards__item h2 a:hover { text-decoration: underline; color: var(--red); }

/* The heading link covers the whole card, so the photo is clickable without
   being a second link to the same page in the accessibility tree. */
.cards__item h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.cards__item:focus-within {
  outline: 3px solid var(--olive);
  outline-offset: 2px;
}

.cards__item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

/* --- footer ------------------------------------------------------------- */

.footer {
  background: var(--olive);
  color: var(--olive-pale);
  padding: 1.75rem var(--gap);
  text-align: center;
  font-size: 0.875rem;
}

.footer p { margin: 0; }
.footer__note { color: var(--olive-soft); margin-top: 0.35rem; }

/* --- reduced motion ----------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
