/* ==========================================================================
   Periodic Table of Wine — site styles
   Tokens lifted verbatim from the original index.html so the grape pages and
   the table read as one object.

   Type note: Courier Prime is kept for tiles, labels and metadata — it is the
   brand voice. Long-form description copy uses a system serif stack instead:
   400 words of monospace is punishing to read, and nobody finishes it. No
   extra font is downloaded for this.
   ========================================================================== */

:root {
  /* Declare the theme. Without this, Chrome on Android applies its own
     "auto dark theme" on top of ours: it rewrites colours it thinks are
     light, which turned the gold masthead green and the gradient headings
     into near-black on near-black. Saying the page is already dark makes
     the browser leave our palette alone. */
  color-scheme: dark;

  --bg:        #0C0A07;
  --paper:     #181410;
  --paper-2:   #1F1A14;
  --gold:      #C8A84B;
  --gold-dim:  rgba(200, 168, 75, 0.45);
  --text:      #F0E8D8;
  --text-dim:  #7A6A5A;
  --text-mid:  #A89684;
  --rule:      rgba(200, 168, 75, 0.18);

  --cell-w: 58px;
  --cell-h: 64px;
  --gap: 4px;

  --mono:  'Courier Prime', ui-monospace, 'Cascadia Mono', Menlo, monospace;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --body:  Iowan Old Style, 'Palatino Linotype', Palatino, Georgia, serif;

  --measure: 68ch;
  --pad: 20px;
}

/* style-group accents — single source for tiles, badges, rules ------------- */
.g-spark  { --accent: #4A7FA5; --fill-a: #1A4A68; --fill-b: #0A2035; }
.g-red    { --accent: #8B1A1A; --fill-a: #6B1515; --fill-b: #3A0808; }
.g-rose   { --accent: #C4607A; --fill-a: #8C3050; --fill-b: #4A1028; }
.g-white  { --accent: #C8A84B; --fill-a: #7A6020; --fill-b: #3A2C0A; }
.g-sweet  { --accent: #C07020; --fill-a: #7A4A10; --fill-b: #3A2005; }
.g-fort   { --accent: #7A5CAC; --fill-a: #3A2060; --fill-b: #1A0C35; }
.g-orange { --accent: #C07A28; --fill-a: #9A5A18; --fill-b: #4A2408; }
.g-rare   { --accent: #3E8A68; --fill-a: #1E4A38; --fill-b: #0C2018; }

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(139, 26, 26, 0.10) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(74, 127, 165, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(200, 168, 75, 0.04) 0%, transparent 70%);
  background-attachment: fixed;
}

a { color: var(--gold); text-decoration-color: var(--gold-dim); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--gold); }

.wrap { max-width: 1180px; margin: 0 auto; padding-inline: var(--pad); }
.narrow { max-width: 780px; }

/* skip link — keyboard users land on content, not the nav ----------------- */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--gold); color: #1A1410; padding: 10px 16px; font-weight: 700;
}
.skip:focus { left: 8px; top: 8px; }

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

/* --- site header --------------------------------------------------------- */
.masthead {
  border-bottom: 1px solid var(--rule);
  padding-block: 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.masthead .brand {
  font-family: var(--serif); font-size: 0.95rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold);
  text-decoration: none;
}
.masthead nav { display: flex; gap: 18px; flex-wrap: wrap; }
.masthead nav a {
  font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-dim); text-decoration: none;
}
.masthead nav a:hover, .masthead nav a[aria-current] { color: var(--gold); }

/* --- breadcrumbs --------------------------------------------------------- */
.crumbs { padding-block: 18px 0; font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs li::after { content: '›'; margin-left: 6px; color: var(--text-dim); }
.crumbs li:last-child::after { content: ''; }
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--gold); }
.crumbs [aria-current] { color: var(--text-mid); }

/* --- grape page hero ----------------------------------------------------- */
.hero { display: flex; gap: 26px; align-items: flex-start; padding-block: 26px 8px; flex-wrap: wrap; }

.tile {
  width: 104px; height: 116px; flex: none;
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 4px;
  background: linear-gradient(160deg, var(--fill-a) 0%, var(--fill-b) 100%);
  padding: 7px 5px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
.tile::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, transparent 60%);
}
.tile .num { font-size: 0.6rem; color: rgba(255, 255, 255, 0.4); line-height: 1; align-self: flex-end; }
.tile .sym { font-family: var(--serif); font-size: 2rem; font-weight: 700; line-height: 1; text-align: center; color: #fff; }
.tile .nm  { font-size: 0.55rem; text-align: center; color: rgba(255, 255, 255, 0.7); line-height: 1.25; }
.tile .tag { font-size: 0.48rem; text-align: center; color: rgba(255, 255, 255, 0.38); text-transform: uppercase; letter-spacing: 0.06em; }

.hero-text { flex: 1 1 320px; min-width: 0; }
.hero h1 {
  font-family: var(--serif); font-weight: 900; line-height: 1.08;
  font-size: clamp(1.9rem, 5.5vw, 3rem); letter-spacing: 0.01em;
  background: linear-gradient(135deg, #B8940A 0%, #F0D060 35%, #E0B840 65%, #A07020 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  padding-bottom: 0.06em;
}
.badge {
  display: inline-block; margin-top: 10px; padding: 4px 11px; border-radius: 2px;
  font-size: 0.58rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text); background: var(--fill-a); border: 1px solid var(--accent);
  text-decoration: none;
}
.synonyms { margin-top: 12px; font-size: 0.72rem; color: var(--text-dim); }
.synonyms b { color: var(--text-mid); font-weight: 400; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.62rem; }
.tagline {
  margin-top: 14px; font-family: var(--body); font-size: 1.06rem;
  line-height: 1.5; color: var(--text-mid); font-style: italic;
}

/* --- section furniture --------------------------------------------------- */
section { padding-block: 26px; }
h2 {
  font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--gold);
  margin-bottom: 4px;
}
.rule { height: 1px; background: linear-gradient(90deg, var(--gold-dim), transparent); margin-bottom: 16px; }

.prose { font-family: var(--body); font-size: 1.08rem; line-height: 1.72; max-width: var(--measure); color: var(--text); }
.prose p + p { margin-top: 1.05em; }

/* --- tasting profile (pure CSS bars, no JS) ------------------------------ */
.profile { display: grid; gap: 11px; max-width: 460px; }
.profile-row { display: grid; grid-template-columns: 82px 1fr 58px; gap: 12px; align-items: center; }
.profile-row .lbl { font-size: 0.62rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.pips { display: flex; gap: 4px; }
.pip { height: 9px; flex: 1; border-radius: 1px; background: rgba(255, 255, 255, 0.07); }
.pip.on { background: var(--accent); }
.profile-row .val { font-size: 0.62rem; color: var(--text-dim); text-align: right; white-space: nowrap; }

/* --- chip lists ---------------------------------------------------------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: 0.68rem; padding: 5px 11px; border-radius: 2px;
  background: var(--paper); border: 1px solid var(--rule); color: var(--text-mid);
}
.chip.muted { opacity: 0.62; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 24px; }
.cols h3 { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 9px; font-weight: 400; }

.facts { display: grid; gap: 10px; }
.fact { display: grid; grid-template-columns: 120px 1fr; gap: 12px; font-size: 0.8rem; align-items: baseline; }
.fact dt { font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.fact dd { color: var(--text-mid); }

/* --- related grapes ------------------------------------------------------ */
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.related a {
  display: flex; gap: 11px; align-items: center; text-decoration: none;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 3px;
  padding: 11px; transition: border-color 0.15s, transform 0.15s;
}
.related a:hover { border-color: var(--accent); transform: translateY(-2px); }
.related .mini {
  width: 34px; height: 38px; flex: none; border-radius: 2px;
  background: linear-gradient(160deg, var(--fill-a) 0%, var(--fill-b) 100%);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 0.82rem; color: #fff;
}
.related .rn { font-size: 0.72rem; color: var(--text); line-height: 1.3; }
.related .rs { font-size: 0.56rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

/* --- affiliate block ----------------------------------------------------- */
.buy {
  background: var(--paper-2); border: 1px solid var(--gold-dim); border-radius: 4px;
  padding: 20px; max-width: var(--measure);
}
.buy h2 { font-size: 1.05rem; margin-bottom: 10px; }
.buy .merchants { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.buy .cta {
  display: inline-block; padding: 10px 18px; border-radius: 2px;
  background: var(--gold); color: #1A1410; text-decoration: none;
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 700;
}
.buy .cta:hover { background: #E0C060; }
.disclosure-line { margin-top: 13px; font-size: 0.62rem; color: var(--text-dim); line-height: 1.5; }

/* --- ad slots — reserved height, below the fold, never over the table ----- */
.ad-slot {
  margin-block: 34px; padding: 12px; border: 1px dashed rgba(200, 168, 75, 0.22);
  border-radius: 3px; text-align: center; background: rgba(255, 255, 255, 0.014);
}
.ad-slot > .ad-label {
  display: block; font-size: 0.52rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 8px;
}
/* Height is reserved so the slot cannot shift layout when a unit loads.
   Unreserved slots cause CLS, which is a Core Web Vitals ranking signal. */
.ad-slot .ad-box { min-height: 250px; display: grid; place-items: center; color: rgba(122, 106, 90, 0.5); font-size: 0.62rem; }
@media (min-width: 720px) { .ad-slot .ad-box { min-height: 90px; } }

/* --- review notice (only where fields are unverified) -------------------- */
.review-note {
  margin-top: 14px; padding: 11px 14px; border-left: 2px solid var(--gold-dim);
  background: rgba(200, 168, 75, 0.05); font-size: 0.7rem; color: var(--text-dim); line-height: 1.55;
  max-width: var(--measure);
}

/* --- footer -------------------------------------------------------------- */
footer {
  border-top: 1px solid var(--rule); margin-top: 44px; padding-block: 26px 40px;
  font-size: 0.62rem; color: var(--text-dim); line-height: 1.8;
}
footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
footer a { color: var(--text-dim); }

/* --- age gate ------------------------------------------------------------
   Content is always present in the DOM underneath. The overlay only paints
   on top, so crawlers and no-JS visitors get the full page. -------------- */
#age-gate {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(12, 10, 7, 0.97); padding: var(--pad);
}
#age-gate[hidden] { display: none; }
#age-gate .panel {
  max-width: 400px; text-align: center; background: var(--paper);
  border: 1px solid var(--gold-dim); border-radius: 4px; padding: 32px 26px;
}
#age-gate h2 { font-size: 1.25rem; margin-bottom: 12px; }
#age-gate p { font-size: 0.74rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 20px; }
#age-gate button {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 11px 22px; border-radius: 2px; cursor: pointer; border: 1px solid var(--gold-dim);
  background: var(--gold); color: #1A1410; font-weight: 700;
}
#age-gate .leave { background: transparent; color: var(--text-dim); margin-left: 8px; }

/* --- print: posters and t-shirt artwork ---------------------------------- */
@media print {
  .masthead, .crumbs, .ad-slot, .buy, footer, #age-gate, .skip { display: none !important; }
  body { background: #fff; color: #000; }
}

/* --- contact -------------------------------------------------------------- */
.contact-email { font-size: 1.35rem; letter-spacing: 0.02em; }
.contact-note {
  margin-top: 18px; max-width: var(--measure);
  font-family: var(--body); font-size: 0.95rem; line-height: 1.7;
  color: var(--text-mid);
}
/* A build-time note for whoever maintains the site, not for visitors. */
.dev-note { display: block; margin-top: 6px; opacity: 0.65; }

/* Obfuscated address. Before scripting runs it reads "name at host dot tld";
   assets/js/email.js swaps in a real link. Both states must look deliberate,
   so the wrapper carries the styling and the link inherits it. */
.eml { color: var(--gold); overflow-wrap: anywhere; }
.eml a.eml-link { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.eml a.eml-link:hover { color: var(--text); }

/* ==========================================================================
   Phones

   The desktop type scale is built around a mouse and a long viewing
   distance: 0.62rem labels are legible on a monitor and about 10px on a
   phone held at arm's length. Navigation, breadcrumbs and footer links all
   sat at that size, and their tap targets were 11-18px tall against a
   ~44px guideline. Nothing here changes the design — it changes the scale
   and the hit areas, which is what actually differs on a phone.
   ========================================================================== */
@media (max-width: 860px) {
  .masthead { padding-block: 12px; gap: 8px; }
  .masthead .brand { font-size: 1.05rem; letter-spacing: 0.06em; }
  .masthead nav { gap: 4px; width: 100%; }
  .masthead nav a {
    font-size: 0.76rem; letter-spacing: 0.14em;
    padding: 9px 10px 9px 0; margin-right: 8px;   /* tap area, not visual size */
  }

  .crumbs { font-size: 0.7rem; padding-block: 14px 0; }
  .crumbs a { padding-block: 7px; display: inline-block; }

  footer { font-size: 0.72rem; margin-top: 32px; }
  footer nav { gap: 2px 18px; }
  footer a { padding-block: 8px; display: inline-block; }

  .hero { gap: 16px; padding-block: 18px 4px; }
}

/* Hover belongs to devices that have a pointer. On a touch screen a tapped
   element keeps :hover until something else is tapped, so a lifted, glowing
   tile stays stuck that way after you come back from its page. */
@media (hover: none) {
  .cell:hover { transform: none; box-shadow: none; }
  .cell:hover .tooltip { opacity: 0; visibility: hidden; }
}

/* Page furniture that is legible on a monitor and not on a phone. Same
   design, larger scale — these are all secondary labels sized for a mouse
   and a desk, and they fall to 8-10px in the hand. */
@media (max-width: 860px) {
  .tile .nm  { font-size: 0.78rem; }
  .tile .tag { font-size: 0.66rem; }

  .badge { font-size: 0.72rem; padding: 8px 14px; letter-spacing: 0.12em; }

  .synonyms   { font-size: 0.85rem; }
  .synonyms b { font-size: 0.72rem; }

  .profile-row .lbl,
  .profile-row .val { font-size: 0.78rem; }

  .contact-email { font-size: 1.15rem; }
  .contact-note  { font-size: 1rem; }

  .cols h3 { font-size: 0.78rem; letter-spacing: 0.12em; }
  .chip    { font-size: 0.8rem; padding: 6px 11px; }
  .facts dt, .facts dd { font-size: 0.82rem; }
  .tile .num { font-size: 0.72rem; }

  .eml { font-size: 0.95rem; }

  .related .rn { font-size: 0.92rem; }
  .related .rs { font-size: 0.7rem; }
  .ad-slot > .ad-label { font-size: 0.66rem; }
}
