/* Digital 1010 · «postales y cartas de costa».
   Cool chart paper, near-black ink, one colour per type of place. Pairs are postcards: a photo or,
   without one, the place set in type on the section colour; a round postmark carries the section
   and the date of the check, and the distance goes on a perforated postage stamp.
   build.py sets --sec on a section's blocks from site.json color_token. */

@font-face {
  font-family: "Instrument Sans";
  src: url("/assets/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --paper: #f3f6f5;      /* chart paper, cool */
  --paper-2: #e6ecea;    /* recessed blocks, footer */
  --ink: #15191b;
  --ink-dim: #4a5558;
  --line: #c3cfcc;       /* graticule and rules */
  --link: #135a72;
  --mar: #0c6570;        /* sea teal */
  --mar-2: #cfe4e1;
  --islas: #0b7a78;      /* turquoise, with sand */
  --islas-2: #ead8ab;
  --ciudad: #a5412a;     /* terracotta */
  --ciudad-2: #f1d3c3;
  --interior: #6b641a;   /* olive ochre */
  --interior-2: #e4d396;
  --interior-3: #f2e7b8;  /* sand text on the olive postcard front (4.9:1) */
  --on-sec: #ffffff;
  --sec: var(--ink);
  --sec-2: var(--line);
  --face-k: 100%;        /* share of the section colour on a postcard front without photo */
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --measure: 66ch;
  --gutter: clamp(1rem, 4vw, 4.5rem);
  --wave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='9' viewBox='0 0 40 9'%3E%3Cpath d='M0 4.5c5-4 15-4 20 0s15 4 20 0' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E");
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1615;
    --paper-2: #17201f;
    --ink: #e6ecea;
    --ink-dim: #a3b0ad;
    --line: #2d3b38;
    --link: #8fd0d4;
    --mar: #5cb8b6;
    --mar-2: #1e3d3c;
    --islas: #66d2c5;
    --islas-2: #4a4129;
    --ciudad: #e6937a;
    --ciudad-2: #45291f;
    --interior: #cfbf63;
    --interior-2: #3d3818;
    --on-sec: #0f1615;
    --face-k: 44%;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.125rem/1.6 var(--sans); font-stretch: 100%;
  overflow-wrap: break-word; font-synthesis: none;
}
.sec-mar { --sec: var(--mar); --sec-2: var(--mar-2); }
.sec-islas { --sec: var(--islas); --sec-2: var(--islas-2); }
.sec-ciudad { --sec: var(--ciudad); --sec-2: var(--ciudad-2); }
.sec-interior { --sec: var(--interior); --sec-2: var(--interior-2); }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--serif); font-style: italic; font-weight: 400; line-height: 1.02; letter-spacing: -0.01em; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2.6rem, 7vw, 6rem); }
h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); }
h3 { font-size: clamp(1.5rem, 2.2vw, 1.9rem); }
p { margin: 0 0 1em; }
.wrap { margin-inline: var(--gutter); }
.prose p, .lead p, .article p, .article li, .note, .credit, .prose li { max-width: var(--measure); }
.lead { font-size: clamp(1.2rem, 1.9vw, 1.45rem); line-height: 1.5; max-width: 46ch; }
.lead p { max-width: none; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 10; }
.skip:focus { left: 0; }

/* Header -------------------------------------------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem 2rem; padding-block: 1rem; }
.brand { display: inline-grid; grid-template-columns: auto auto; column-gap: 0.7rem; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark { grid-row: span 2; width: 2.75rem; height: 2.75rem; background: url("/favicon.svg") center / contain no-repeat; }
.brand-name { font: italic 400 1.75rem/1 var(--serif); }
.tagline { font-size: 0.8125rem; line-height: 1.3; color: var(--ink-dim); font-stretch: 90%; }
.site-footer .brand { display: inline-block; font: italic 400 1.75rem/1 var(--serif); margin-bottom: 0.6rem; }
.nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.6rem; list-style: none; margin: 0; padding: 0; }
.nav li:nth-child(1) { --u: var(--mar); }
.nav li:nth-child(2) { --u: var(--islas); }
.nav li:nth-child(3) { --u: var(--ciudad); }
.nav li:nth-child(4) { --u: var(--interior); }
.nav a { --u-w: 0; color: var(--ink); text-decoration: none; font-weight: 600; font-stretch: 92%; display: inline-block; padding: 0.35rem 0; box-shadow: inset 0 calc(-1 * var(--u-w)) 0 var(--u, var(--ink)); }
.nav a:hover { --u-w: 2px; }
.nav a[aria-current] { --u-w: 4px; }
.nav-toggle { display: none; }
@media (max-width: 640px) {
  .js .nav-toggle { display: block; font: 600 1rem/1 var(--sans); color: var(--ink); background: transparent; border: 1.5px solid var(--ink); border-radius: 999px; padding: 0.55rem 1rem; cursor: pointer; }
  .js .site-header nav { width: 100%; }
  .js .site-header nav:has(.nav:not(.open)) { display: none; }
  .js .nav { flex-direction: column; gap: 0; }
  .js .nav a { display: block; padding: 0.85rem 0 0.85rem 0.9rem; border-bottom: 1px solid var(--line); box-shadow: inset 4px 0 0 var(--u, var(--ink)); }
}

/* Footer -------------------------------------------------------------------------------------- */
.site-footer { position: relative; margin-top: clamp(3rem, 8vw, 6rem); padding-block: 3rem 2.5rem; background: var(--paper-2); font-size: 0.9375rem; }
.site-footer::before { content: ""; position: absolute; inset: -9px 0 auto; height: 18px; background: var(--line); -webkit-mask: var(--wave) 0 0 / 40px 9px repeat; mask: var(--wave) 0 0 / 40px 9px repeat; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.75rem 2rem; }
.site-footer h2 { font: 600 0.9375rem/1.3 var(--sans); font-style: normal; letter-spacing: 0; color: var(--ink-dim); margin-bottom: 0.6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 0.35rem; }
.site-footer a { color: var(--ink); }
.legal { color: var(--ink-dim); margin-top: 1.5rem; font-size: 0.875rem; max-width: 90ch; }

/* Common blocks ------------------------------------------------------------------------------- */
.hero, .block { padding-block: clamp(2rem, 5vw, 4rem); }
.sunk { background: var(--paper-2); }
.page-head { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2.5rem); }
.page-head h1 { max-width: 18ch; }
.crumbs { display: flex; flex-wrap: wrap; gap: 0.25rem 0.6rem; list-style: none; margin: 0 0 1.5rem; padding: 0; font-size: 0.875rem; color: var(--ink-dim); }
.crumbs a { color: var(--ink-dim); }
.crumbs li + li::before { content: "/"; margin-right: 0.6rem; }
.place, .to { color: var(--ink-dim); }
.credit { color: var(--ink-dim); font-size: 0.8125rem; line-height: 1.45; }
.credit a { color: inherit; }
.note { border-left: 3px solid var(--sec, var(--line)); padding-left: 1rem; color: var(--ink-dim); }
.links { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; list-style: none; padding: 0; margin: 0 0 1.5rem; }
.links a { font: italic 400 clamp(1.6rem, 3vw, 2.2rem)/1.2 var(--serif); color: var(--ink); text-decoration-color: var(--line); }
.links li:has(a[href="/mar/"]) { --sec: var(--mar); }
.links li:has(a[href="/islas/"]) { --sec: var(--islas); }
.links li:has(a[href="/ciudad/"]) { --sec: var(--ciudad); }
.links li:has(a[href="/interior/"]) { --sec: var(--interior); }
.links a:hover { color: var(--sec); }

/* The perforated postage stamp: distance between hotel and casino */
.stamp {
  --hole: var(--paper);
  display: inline-block; margin: 0 0 0.9rem; padding: 0.4rem 0.85rem 0.35rem;
  font-size: 0.875rem; font-weight: 600; font-stretch: 88%; line-height: 1.3; color: var(--on-sec);
  background:
    radial-gradient(circle, var(--hole) 2.4px, transparent 2.8px) 0 -4px / 8px 8px repeat-x,
    radial-gradient(circle, var(--hole) 2.4px, transparent 2.8px) 0 calc(100% + 4px) / 8px 8px repeat-x,
    radial-gradient(circle, var(--hole) 2.4px, transparent 2.8px) -4px 0 / 8px 8px repeat-y,
    radial-gradient(circle, var(--hole) 2.4px, transparent 2.8px) calc(100% + 4px) 0 / 8px 8px repeat-y,
    var(--sec);
}
.stamp a { color: inherit; }

/* The postmark: section and date of the check, stamped over the corner of the postcard */
.cover { position: relative; }
.postmark {
  position: absolute; z-index: 1; top: -1.1rem; right: 1.1rem;
  width: 6.4rem; aspect-ratio: 1; border-radius: 50%;
  display: grid; place-content: center; gap: 0.1rem; text-align: center;
  color: var(--sec); background: var(--paper);
  border: 3px double var(--sec); box-shadow: 0 0 0 4px var(--paper);
  transform: rotate(-11deg);
}
.postmark::after {
  content: ""; position: absolute; top: 50%; right: 100%; width: 5.5rem; height: 27px; margin-top: -13.5px;
  background: var(--paper); opacity: 0.9;
  -webkit-mask: var(--wave) 0 0 / 40px 9px repeat; mask: var(--wave) 0 0 / 40px 9px repeat;
}
.pm-sec { font: italic 400 1.45rem/1 var(--serif); }
.pm-date { font-size: 0.75rem; font-weight: 600; font-stretch: 80%; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

/* Postcard front without a photo: the place set in type on a chart of the section colour */
.card-face {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  aspect-ratio: 3 / 2; padding: clamp(1rem, 2.5vw, 1.75rem); overflow: hidden;
  color: #fff; background:
    repeating-linear-gradient(90deg, transparent 0 calc(3rem - 1px), color-mix(in srgb, var(--sec-2) 30%, transparent) calc(3rem - 1px) 3rem),
    repeating-linear-gradient(0deg, transparent 0 calc(3rem - 1px), color-mix(in srgb, var(--sec-2) 30%, transparent) calc(3rem - 1px) 3rem),
    color-mix(in oklab, var(--sec) var(--face-k), #0f1615);
  outline: 1px solid color-mix(in srgb, #fff 55%, transparent); outline-offset: -0.6rem;
}
.cf-place { font: italic 400 clamp(2.4rem, 6vw, 4.5rem)/0.95 var(--serif); letter-spacing: -0.015em; }
.cf-prov { margin-top: 0.45rem; font-size: 0.875rem; font-weight: 600; font-stretch: 85%; color: var(--sec-2); }
.sec-interior .cf-prov { color: var(--interior-3); } /* --interior-2 on --interior gave 4.1:1 */
@media (prefers-color-scheme: dark) { .cf-prov, .sec-interior .cf-prov { color: color-mix(in oklab, var(--sec) 70%, #fff); } }

.figure, .row-photo, .entry-photo { margin: 0; }
.row-photo img, .entry-photo img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
figcaption.credit { margin-top: 0.5rem; }

/* Home ---------------------------------------------------------------------------------------- */
.hero {
  padding-block: clamp(2.5rem, 7vw, 6rem) clamp(2rem, 5vw, 4rem);
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(5rem - 1px), color-mix(in srgb, var(--line) 55%, transparent) calc(5rem - 1px) 5rem),
    repeating-linear-gradient(0deg, transparent 0 calc(5rem - 1px), color-mix(in srgb, var(--line) 55%, transparent) calc(5rem - 1px) 5rem);
  border-bottom: 1px solid var(--line);
}
.hero h1 { font-size: clamp(3.2rem, 10vw, 9rem); line-height: 0.92; max-width: 11ch; margin-bottom: 0.35em; }
.hero .lead { background: var(--paper); box-shadow: 0 0 0 0.5rem var(--paper); max-width: 44ch; }
.entries { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: clamp(0.75rem, 2vw, 1.25rem); list-style: none; padding: 0; margin: clamp(2rem, 5vw, 3.5rem) 0 0; }
.entry { position: relative; display: flex; flex-direction: column; background: var(--paper); border-top: 6px solid var(--sec); padding: 0 0 1rem; }
.entry > a { font: italic 400 clamp(2rem, 4vw, 3.4rem)/1 var(--serif); color: var(--sec); text-decoration: none; margin: 0.9rem 1rem 0.2rem; }
.entry > a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.entry > p { margin: 0 1rem; color: var(--ink-dim); font-size: 0.9375rem; }
.entry .credit { margin: 0.4rem 1rem 0; }
.entry.bare { justify-content: flex-end; min-height: clamp(9rem, 22vw, 13rem); border-top: 0; padding: clamp(0.9rem, 2vw, 1.25rem); color: #fff;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(2.5rem - 1px), color-mix(in srgb, var(--sec-2) 30%, transparent) calc(2.5rem - 1px) 2.5rem),
    repeating-linear-gradient(0deg, transparent 0 calc(2.5rem - 1px), color-mix(in srgb, var(--sec-2) 30%, transparent) calc(2.5rem - 1px) 2.5rem),
    color-mix(in oklab, var(--sec) var(--face-k), #0f1615); }
.entry.bare > a { color: inherit; margin: 0 0 0.3rem; }
.entry.bare > a::after { content: ""; position: absolute; inset: 0; }
.entry.bare > p { color: inherit; margin: 0; opacity: 0.9; }
@media (prefers-color-scheme: dark) { .entry { background: var(--paper-2); } }

.block > .wrap > h2 { display: flex; align-items: baseline; gap: 1.25rem; font-size: clamp(3rem, 7vw, 5.5rem); margin-bottom: 0.4em; }
.block > .wrap > h2::after { content: ""; flex: 1; height: 1px; background: var(--sec); opacity: 0.6; }
.block > .wrap > h2 a { color: var(--sec); text-decoration: none; }
.block > .wrap > h2 a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.sunk > .wrap > h2 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); }
.sunk > .wrap > h2::after { background: var(--line); opacity: 1; }
.claims { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1.5rem 2.5rem; margin-bottom: 1.5rem; }
.claims p { max-width: 42ch; }
.claims strong { display: block; font: italic 400 1.75rem/1.1 var(--serif); margin-bottom: 0.4rem; }

/* Pairs as postcards in a list ---------------------------------------------------------------- */
.rows { display: grid; gap: clamp(2.5rem, 5vw, 3.5rem); list-style: none; padding: 0; margin: 0; }
.row { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.25rem clamp(1.5rem, 4vw, 3.5rem); align-items: start; padding-top: 2rem; border-top: 1px solid var(--line); }
.row .postmark { width: 5.4rem; top: -1.4rem; right: 0.8rem; }
.row .postmark::after { width: 4rem; }
.row .pm-sec { font-size: 1.25rem; }
.row-text { padding-top: 0.25rem; }
.row h2, .row h3 { font-size: clamp(1.9rem, 3.4vw, 2.9rem); margin: 0.1rem 0 0.3rem; }
.row h2 a, .row h3 a { color: var(--ink); text-decoration-color: var(--sec); text-decoration-thickness: 1px; }
.row h2 a:hover, .row h3 a:hover { text-decoration-thickness: 2px; }
.row .to { font-weight: 600; font-stretch: 92%; margin-bottom: 0.6rem; }
.row-text > p:last-child { max-width: 52ch; }
@media (max-width: 760px) { .row { grid-template-columns: 1fr; } }
@media (min-width: 1400px) { .rows { grid-template-columns: repeat(auto-fill, minmax(38rem, 1fr)); column-gap: 3.5rem; } }

/* Section page -------------------------------------------------------------------------------- */
[style*="--sec"] > .page-head h1 { color: var(--sec); font-size: clamp(3.6rem, 12vw, 10rem); line-height: 0.9; }
.pair > .page-head h1 { font-size: clamp(2.5rem, 6vw, 5.4rem); line-height: 0.98; color: var(--ink); max-width: 20ch; }
.wrap > .block { border-top: 1px solid var(--line); margin-top: clamp(2rem, 5vw, 4rem); }
.wrap > .block > h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }

/* Pair page ----------------------------------------------------------------------------------- */
.pair .place { font-size: 0.9375rem; }
.pair > .cover { margin: 2.2rem 0 clamp(2rem, 5vw, 3.5rem); }
.pair > .cover .card-face { aspect-ratio: 21 / 8; }
.pair > .cover .cf-place { font-size: clamp(3.4rem, 11vw, 10rem); }
.pair > .cover .cf-prov { font-size: 1rem; }
.pair > .cover .figure img { width: 100%; max-height: 82vh; object-fit: cover; }
.pair > .cover .postmark { width: 8rem; top: -2.2rem; right: clamp(1rem, 4vw, 3rem); }
.pair > .cover .postmark::after { width: 7rem; }
.pair > .cover .pm-sec { font-size: 1.85rem; }
.pair > .cover .pm-date { font-size: 0.75rem; }
@media (max-width: 640px) {
  .pair > .cover .card-face { aspect-ratio: 4 / 3; }
  .pair > .cover .postmark { width: 6.4rem; top: -1.8rem; }
  .pair > .cover .pm-sec { font-size: 1.45rem; }
}

/* Journal grid: the heading of a part in the margin, the text beside it */
.part, .article > section { border-top: 1px solid var(--line); padding-block: clamp(1.5rem, 3vw, 2.5rem); }
.part > h2 { color: var(--sec); }
@media (min-width: 960px) {
  .part, .article > section { display: grid; grid-template-columns: minmax(13rem, 1fr) minmax(0, 3fr); column-gap: clamp(2rem, 4vw, 4rem); }
  .part > *, .article > section > * { grid-column: 2; }
  .part > h2, .article > section > h2 { grid-column: 1; grid-row: 1 / span 20; align-self: start; position: sticky; top: 1.5rem; }
}
.part h3 { margin-top: 0.2rem; }
.leg-figure { font: italic 400 clamp(3rem, 8vw, 6rem)/1 var(--serif); color: var(--sec); margin: 0 0 0.6rem; }

/* Facts as the address lines on the back of a postcard */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 0 2.5rem; margin: 1.75rem 0 1.25rem; }
.facts > div { padding: 0.7rem 0 0.75rem; border-bottom: 1px solid var(--line); }
.facts dt { font-size: 0.8125rem; font-weight: 600; font-stretch: 88%; color: var(--sec); }
.facts dd { margin: 0.15rem 0 0; line-height: 1.45; }
.ref { font-size: 0.72em; line-height: 0; font-weight: 600; }
.ref a { text-decoration: none; }
.sources { margin: 0; padding-left: 1.6rem; font-size: 0.9375rem; }
@media (min-width: 1200px) { .sources { columns: 2; column-gap: 3rem; } }
.sources li { margin-bottom: 0.5rem; break-inside: avoid; }
.sources li::marker { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.sources li:target { background: var(--paper-2); outline: 2px solid var(--sec); }
.pair > .block { border-top: 1px solid var(--line); }

/* Table of all pairs -------------------------------------------------------------------------- */
.pairs { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; font-size: 1rem; }
.pairs thead th { font-size: 0.8125rem; font-weight: 600; font-stretch: 88%; color: var(--ink-dim); border-bottom: 2px solid var(--ink); }
.pairs th, .pairs td { text-align: left; padding: 0.85rem 1.25rem 0.85rem 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.pairs tbody th { font-weight: 600; }
.pairs tbody th a { color: var(--ink); }
.pairs td:first-child a { font: italic 400 1.5rem/1 var(--serif); text-decoration: none; }
.pairs a[href="/mar/"] { color: var(--mar); }
.pairs a[href="/islas/"] { color: var(--islas); }
.pairs a[href="/ciudad/"] { color: var(--ciudad); }
.pairs a[href="/interior/"] { color: var(--interior); }
.pairs td:last-child { white-space: nowrap; }
@media (max-width: 640px) {
  .pairs thead { position: absolute; left: -9999px; }
  .pairs tr { display: block; border-bottom: 1px solid var(--line); padding-block: 0.9rem; }
  .pairs th, .pairs td { display: block; border: 0; padding: 0.1rem 0; }
  .pairs td:last-child { white-space: normal; }
  .pairs td:not(:first-child)::before { content: attr(data-label) ": "; color: var(--ink-dim); font-size: 0.875rem; }
}

/* Service pages ------------------------------------------------------------------------------- */
.article > section > h2 { font-size: clamp(1.7rem, 2.6vw, 2.2rem); }
.article ul { padding-left: 1.2rem; }
.article li { margin-bottom: 0.4rem; }

@media (prefers-reduced-motion: no-preference) {
  .row .postmark, .entry > a { transition: transform 0.25s ease; }
  .row:hover .postmark { transform: rotate(-4deg); }
}
