/* Agavist's search pages (/learn, /agaves, /cities; site/tools/guides.py), over styles.css.
   A field guide in the app's own world: each plant's wall colour, the cream arch, the talavera band, the plant's drawing.
   The licensed photo sits only inside the arch, framed by its cream, never bare. On a phone the wall carries the plate and
   the question opens on white under the band; on a wide screen the question stands on the wall beside the plate.
   The wall's colour is the page's one accent: the wall, the band's frame, the shelf, the underline under a link. Words
   stay ink. The facts sit on a paper label, the herbarium label the old plates carried (the site's paper, img/paper.webp).
   --wall and --on-wall arrive on the body, as on the bottle pages. */

body.g { background: #fff; min-height: 100svh; display: flex; flex-direction: column; }
.g { --measure: 40rem; --read: #241f19; }

/* ---------- the first screen ---------- */
.g-hero { display: grid; grid-template-columns: minmax(0, 1fr); }
.g-top { order: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem var(--gutter) 0; background: var(--wall); color: var(--on-wall); }
.g-top .brand, .g-top .brand:hover { color: var(--on-wall); }
.g-top .mark { width: 2rem; height: 2rem; color: var(--on-wall); --gap: var(--wall); }
.g-top .word { font-size: 1.55rem; color: var(--on-wall); }
.g-nav { display: flex; gap: 1.05rem; }
.g-nav a { font: 600 .95rem/1 var(--display); color: var(--on-wall); text-decoration: none; padding: .95rem 0; }   /* 44 px to tap */
.g-nav a:hover { color: var(--on-wall); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .35em; }
.g-nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .35em; }

/* the plate: the arch with the photo in it, the drawing standing beside it on the band. Sized in em so a wide screen
   scales the whole scene at once. */
.g-plate { order: 2; position: relative; height: 21.5em; font-size: 1rem; background: var(--wall); overflow: hidden; }
.g-plate .arch { position: absolute; bottom: 0; left: calc(50% - 10.2em); width: 13.4em; height: 19.6em; padding: .55em .55em 0; border-radius: 6.7em 6.7em 0 0; background: var(--window); box-shadow: 0 -1px 0 rgba(23, 20, 16, .06); }
.g-plate .photo { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; border-radius: 6.15em 6.15em 0 0; }
.g-plate .drawing { position: absolute; bottom: -.15em; left: calc(50% + .9em); width: 12.6em; height: auto; filter: drop-shadow(0 .3em .4em rgba(58, 46, 26, .18)); }
.g-plate--solo .arch { left: calc(50% - 6.7em); }
.g-plate .inarch { position: absolute; bottom: .2em; left: 50%; translate: -50% 0; width: 118%; max-width: none; height: auto; }
.g-plate--solo .arch { overflow: visible; }
.g-hero .band { order: 3; }
.band { height: 16px; background: radial-gradient(circle at 9px 50%, var(--window) 3.5px, transparent 4.2px) 0 0 / 20px 100% repeat-x, var(--talavera); }

.g-head { order: 4; display: grid; justify-items: start; gap: .9rem; padding: 1.7rem var(--gutter) .4rem; }
.g-crumb { font: 600 .95rem/1.2 var(--display); color: var(--soft); }
.g-crumb a { color: inherit; text-decoration-color: var(--wall); text-decoration-thickness: 2px; text-underline-offset: .3em; padding-block: .8rem; }
.g-head h1 { margin: 0; font: 700 clamp(2.3rem, 9.4vw, 4.4rem)/1.02 var(--display); letter-spacing: -.035em; text-wrap: balance; max-width: 18ch; color: var(--ink); }
.g--agave .g-head h1 { font-size: clamp(3.6rem, 19vw, 8.5rem); line-height: .9; letter-spacing: -.05em; max-width: none; }
.h1-sub { display: block; margin-top: .55rem; font: 400 clamp(1.3rem, 5.2vw, 1.9rem)/1.15 var(--sans); letter-spacing: -.01em; color: var(--soft); }
.h1-sub i.latin { font-family: var(--serif); font-style: italic; }
.g-latin { margin-top: -.2rem; font: italic 400 clamp(1.35rem, 5.4vw, 2rem)/1.15 var(--serif); color: var(--soft); }
.g-head .lead { max-width: 34rem; font: 500 clamp(1.2rem, 1.05rem + .9vw, 1.5rem)/1.42 var(--sans); letter-spacing: -.01em; color: var(--ink); text-wrap: pretty; }
.g-head .lead i.latin, .prose i.latin, .label i.latin { font-family: var(--serif); font-style: italic; font-weight: 400; }
.g-head .lead sup.src a { color: var(--soft); }

/* ---------- the reading column ---------- */
.g-main { width: min(100% - 2 * var(--gutter), var(--shell)); margin-inline: auto; padding-bottom: clamp(3rem, 8vw, 5rem); }
.g-article { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-top: 1.6rem; }
.g-toc { display: none; }

.prose { max-width: var(--measure); color: var(--ink); font-size: 1.125rem; line-height: 1.7; }
.prose > :first-child { margin-top: 0; }
.prose p + p, .prose p + ul, .prose p + ol, .prose ul + p, .prose ol + p, .prose .table + p, .prose p + .table { margin-top: 1.05em; }
.prose h2 { margin: 2.4em 0 .5em; font: 700 clamp(1.5rem, 1.25rem + 1.2vw, 1.9rem)/1.15 var(--display); letter-spacing: -.025em; color: var(--ink); text-wrap: balance; }
.prose h3 { margin: 1.8em 0 .4em; font: 600 1.25rem/1.25 var(--display); letter-spacing: -.015em; color: var(--ink); }
.prose a, .g-sources a, .g-readnext a, .place h3 a { color: var(--ink); text-decoration-color: var(--wall); text-decoration-thickness: 2px; text-underline-offset: .22em; }
.prose a:hover, .g-sources a:hover, .g-readnext a:hover, .place h3 a:hover { color: var(--ink); text-decoration-thickness: 3px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: .45em; }
.prose li::marker { color: var(--soft); }
.prose b { font-weight: 600; color: var(--ink); }
.prose blockquote { margin: 1.4em 0; padding-left: 1.1em; border-left: 3px solid var(--wall); color: var(--ink); font-size: 1.2rem; line-height: 1.5; }
sup.src { font-size: .62em; line-height: 0; vertical-align: .62em; margin-left: .08em; font-weight: 600; font-variant-numeric: tabular-nums; }
sup.src + sup.src { margin-left: .22em; }
sup.src a { color: var(--soft); text-decoration: none; padding: .2em .1em .2em 0; }
sup.src a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--wall); }
.prose .table { overflow-x: auto; margin-block: 1.4em; }
.prose table { width: 100%; border-collapse: collapse; font-size: 1rem; line-height: 1.4; font-variant-numeric: tabular-nums; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: .6rem .9rem .6rem 0; border-bottom: 1px solid var(--rule); }
.prose thead th { font: 600 .95rem/1.2 var(--display); color: var(--soft); border-bottom: 2px solid var(--wall); }
.prose tbody th { font-weight: 600; color: var(--ink); }

/* the facts: a paper label, as the old plates carried one. The label is the page's one piece of paper. */
.label { margin: 0; align-self: start; max-width: 30rem; padding: 1.05rem 1.2rem .6rem; background: var(--paper-grain); color: var(--ink);
  border: 1px solid rgba(17, 19, 22, .55); outline: 1px solid rgba(17, 19, 22, .2); outline-offset: -6px; border-radius: 3px; box-shadow: var(--lift); }
.label-h { padding-bottom: .55rem; font: italic 400 1.3rem/1.2 var(--serif); color: var(--ink); }
.label > div { display: grid; gap: .1rem; padding: .62rem 0; border-top: 1px dashed rgba(23, 20, 16, .28); }
.label dt { font: 600 .9rem/1.3 var(--display); color: var(--soft); }
.label dd { margin: 0; font-size: 1.05rem; line-height: 1.4; }
.label .disagree { display: block; margin-top: .15rem; font-size: .9rem; color: var(--soft); }
.label sup.src a { color: var(--soft); }

/* ---------- bottles made from it: names only, each linking to its bottle page ---------- */
.g-shelf, .g-related, .g-sources { margin-top: clamp(3rem, 7vw, 4.6rem); }
.g-shelf h2, .g-related h2, .g-sources h2 { margin: 0 0 1.2rem; font: 700 clamp(1.5rem, 1.25rem + 1.2vw, 1.9rem)/1.15 var(--display); letter-spacing: -.025em; color: var(--ink); }
.bottles { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); border-top: 4px solid var(--wall); }
.bottles li { display: grid; gap: .1rem; padding: .8rem 0 .85rem; border-bottom: 1px solid var(--rule); }
.bottles a { font: 600 1.125rem/1.3 var(--display); letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.bottles a:hover { text-decoration: underline; text-decoration-color: var(--wall); text-decoration-thickness: 2px; text-underline-offset: .2em; }
.bottles span { font-size: .95rem; color: var(--cap); }

/* ---------- related ---------- */
.g-readnext { margin: 0 0 1.8rem; padding: 0; list-style: none; display: grid; gap: .2rem; max-width: var(--measure); }
.g-readnext a { display: inline-block; padding-block: .45rem; font: 600 clamp(1.2rem, 1.1rem + .5vw, 1.4rem)/1.3 var(--display); letter-spacing: -.015em; }

/* plant tiles: each plant's own wall with its arch and drawing, the shelf of walls the app shows */
.tiles { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem .9rem; }
.tile a { display: grid; gap: .1rem; text-decoration: none; color: var(--ink); }
.t-wall { position: relative; display: flex; align-items: flex-end; justify-content: center; aspect-ratio: 5 / 6; background: var(--wall); overflow: hidden; margin-bottom: .55rem; }
.t-wall::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 9px; background: radial-gradient(circle at 6px 50%, var(--window) 2.2px, transparent 2.7px) 0 0 / 13px 100% repeat-x, var(--talavera); }
.t-arch { position: relative; width: 60%; height: 80%; margin-bottom: 9px; border-radius: 999px 999px 0 0; background: var(--window); }
.tile--photo .t-arch { overflow: hidden; border: .3rem solid var(--window); border-bottom: 0; }
.tile--photo .t-arch img.t-photo { position: static; translate: none; width: 100%; height: 100%; object-fit: cover; border-radius: 999px 999px 0 0; }
.tile--photo a:hover .t-arch img.t-photo { translate: none; }
.g-hubcredits { margin-top: 3rem; } .g-hubcredits ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .3rem; }
.t-arch img { position: absolute; bottom: 0; left: 50%; translate: -50% 0; width: 150%; max-width: none; height: auto; transition: translate .25s ease; }
.tile a:hover .t-arch img { translate: -50% -.3rem; }
.t-name { font: 600 1.15rem/1.2 var(--display); letter-spacing: -.01em; }
.t-latin { font: italic 400 .98rem/1.3 var(--serif); color: var(--soft); }
.tiles--small { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- city guides: places by neighbourhood ---------- */
.g-article--city { gap: 0; }
.g-article--city .prose:empty { display: none; }
.hood { padding-top: 2.2rem; }
.hood h2 { margin: 0 0 .4rem; font: 700 1.5rem/1.15 var(--display); letter-spacing: -.02em; color: var(--wall); }
.hood ul { margin: 0; padding: 0; list-style: none; display: grid; }
.place { padding: 1.05rem 0 1.15rem; border-bottom: 1px solid var(--rule); max-width: var(--measure); }
.place h3 { margin: 0 0 .3rem; font: 700 1.35rem/1.2 var(--display); letter-spacing: -.02em; }
.place .why { font-size: 1.0625rem; line-height: 1.55; color: var(--read); }
.place .addr { margin-top: .35rem; font-size: .95rem; line-height: 1.4; color: var(--cap); }

/* ---------- hubs ---------- */
.g-main--hub { padding-top: 2rem; }
.rows { margin: 0; padding: 0; list-style: none; max-width: 48rem; }
.rows a { display: grid; gap: .3rem; padding: 1.15rem 0 1.25rem; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.r-title { font: 700 clamp(1.45rem, 1.2rem + 1.4vw, 2.2rem)/1.1 var(--display); letter-spacing: -.03em; text-decoration: underline; text-decoration-color: transparent; text-decoration-thickness: 3px; text-underline-offset: .18em; transition: text-decoration-color .15s; }
.rows a:hover .r-title { text-decoration-color: var(--wall); }
.r-desc { font-size: 1.0625rem; line-height: 1.5; color: var(--soft); max-width: 40rem; }

/* ---------- sources, credit ---------- */
.g-sources { max-width: 46rem; font-size: .95rem; line-height: 1.5; color: var(--soft); }
.g-sources h2 { font-size: 1.3rem; }
.g-sources ol { margin: 0; padding-left: 1.6rem; display: grid; gap: .4rem; }
.g-sources li::marker { font-variant-numeric: tabular-nums; color: var(--cap); }
.g-sources li:target { background: color-mix(in srgb, var(--wall) 12%, transparent); }
.g-sources a { color: var(--soft); text-decoration-thickness: 1px; }
.g-sources .read, .g-checked { color: var(--cap); }
.g-checked { margin-top: .9rem; }
.g-credit { margin-top: .5rem; color: var(--cap); }
.g-about { margin-top: .5rem; }

/* ---------- the app line: the wall again, under its band ---------- */
.g-app { background: var(--wall); color: var(--on-wall); }
.g-app::before { content: ""; display: block; height: 16px; background: radial-gradient(circle at 9px 50%, var(--window) 3.5px, transparent 4.2px) 0 0 / 20px 100% repeat-x, var(--talavera); }
.g-app-in { width: min(100% - 2 * var(--gutter), var(--shell)); margin-inline: auto; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .4rem 1rem; padding-block: 2rem 2.2rem; }
.g-app .mark { width: 2.6rem; height: 2.6rem; color: var(--on-wall); --gap: var(--wall); grid-row: span 2; align-self: start; }
.g-app p { font: 600 clamp(1.15rem, 1rem + .8vw, 1.5rem)/1.3 var(--display); letter-spacing: -.015em; max-width: 30ch; text-wrap: balance; }
.g-app .g-soon { font: 500 1rem/1.3 var(--sans); letter-spacing: 0; }
.g-badge { justify-self: start; display: inline-block; padding-block: .3rem; }
.g-badge img { width: 120px; height: 40px; }
.g-get { justify-self: start; display: inline-flex; align-items: center; min-height: 3rem; padding-inline: 1.4rem; border-radius: 10px; background: var(--window); color: var(--ink); font: 650 1.05rem/1 var(--display); text-decoration: none; }
.g-get::after { content: "\2192"; margin-left: .5rem; }

/* the footer is plain, as on the bottle pages */
.g .foot { margin-top: 0; background: #fff; border-top: 0; }
.g .foot, .g .foot-notes, .g .foot-notes a, .g .foot-mail { color: var(--ink); }
.g .foot-sky { padding-bottom: 2.4rem; }
.g .foot-sky a, .g .foot-notes p { text-shadow: none; }

@media (min-width: 40rem) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem 1.2rem; }
  .tiles--small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bottles { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2rem; }
  .hood ul { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 2.6rem; }
}

@media (min-width: 60rem) {
  .g-hero { --col: min(36rem, calc(50vw - var(--gutter))); grid-template-columns: minmax(var(--gutter), 1fr) var(--col) var(--col) minmax(var(--gutter), 1fr); background: var(--wall); color: var(--on-wall); }
  .g-top { grid-column: 2 / 4; grid-row: 1; padding: 1rem 0 0; background: none; }
  .g-top .word { font-size: 1.7rem; }
  .g-head { grid-column: 2; grid-row: 2; align-self: end; padding: 2rem 2rem 3.4rem 0; gap: 1.1rem; }
  .g-plate { grid-column: 3; grid-row: 2; height: 33rem; font-size: 1.52rem; background: none; overflow: visible; }
  .g-hero { overflow: hidden; }
  .g-hero .band { grid-column: 1 / -1; grid-row: 3; }
  .g-head h1, .g-crumb, .g-latin, .g-head .lead, .g-head .lead sup.src a { color: var(--on-wall); }
  .g-crumb a { text-decoration-color: currentColor; }
  .g-head h1 { font-size: clamp(3rem, 4.6vw, 4.6rem); }
  .g--agave .g-head h1 { font-size: clamp(5rem, 9vw, 9rem); }
  .g--hub .g-head h1 { font-size: clamp(4rem, 7vw, 7rem); letter-spacing: -.045em; }
  .h1-sub { display: block; margin-top: .55rem; font: 400 clamp(1.3rem, 5.2vw, 1.9rem)/1.15 var(--sans); letter-spacing: -.01em; color: var(--soft); }
.h1-sub i.latin { font-family: var(--serif); font-style: italic; }
.g-latin { opacity: .92; }

  .g-article { grid-template-columns: minmax(0, 22rem) minmax(0, var(--measure)); justify-content: space-between; column-gap: 4rem; padding-top: 3.4rem; }
  .g--guide .g-article { grid-template-columns: minmax(0, var(--measure)) minmax(0, 17rem); justify-content: space-between; }
  .g-toc { display: block; position: sticky; top: 1.5rem; align-self: start; padding-top: .3rem; }
  .g-toc p { font: 600 .95rem/1.2 var(--display); color: var(--soft); margin-bottom: .6rem; }
  .g-toc ul { margin: 0; padding: 0 0 0 .9rem; list-style: none; display: grid; gap: .1rem; border-left: 2px solid var(--wall); }
  .g-toc a { display: block; padding-block: .32rem; font: 500 .95rem/1.3 var(--sans); color: var(--ink); text-decoration: none; }
  .g-toc a:hover { text-decoration: underline; text-decoration-color: var(--wall); text-decoration-thickness: 2px; text-underline-offset: .2em; }
  .g--agave .g-article { grid-template-columns: minmax(0, var(--measure)) minmax(0, 17rem); justify-content: space-between; }
  .g--agave .label { grid-column: 1 / -1; position: static; max-width: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); column-gap: 2rem; padding: 1.2rem 1.6rem .8rem; }
  .g--agave .label-h { grid-column: 1 / -1; }
  .g--city .g-plate .drawing { display: none; }
  .g--city .g-plate .arch { left: calc(50% - 8em); }

  .label { position: sticky; top: 1.5rem; }
  .prose { font-size: 1.1875rem; }

  .g-article--city { display: block; padding-top: 2rem; }
  .hood { display: grid; grid-template-columns: 15rem minmax(0, 1fr); column-gap: 3rem; padding-top: 2.8rem; }
  .hood h2 { position: sticky; top: 1.5rem; align-self: start; font-size: 1.9rem; padding-top: .9rem; }

  .bottles { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 2rem; }
  .g--city .g-head { grid-column: 3; padding: 2rem 0 3.4rem 2rem; }
  .g--city .g-plate { grid-column: 2; }
  .g--agave .h1-sub { font-size: 2rem; color: var(--on-wall); opacity: .92; }
  .g-head .h1-sub { color: var(--on-wall); }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.6rem 1.6rem; }
  .tiles--small { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 52rem; }
  .g-main--hub { padding-top: 3.4rem; }
  .g-app-in { padding-block: 2.6rem 2.8rem; }
}

@media (min-width: 80rem) {
  .tiles:not(.tiles--small) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .t-arch img { transition: none; }
}
