/* ==========================================================================
   CardPorch — site.css
   Design tokens, reset, layout, typography and the shared page furniture.
   Palette and type per spec §5. System fonts only: ZERO font downloads.
   Audience 45-75 on tablets: body >= 18px, touch targets >= 48px, AA contrast.
   Selectors match the markup in templates/base.html and templates/_macros.html.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens  (game.css builds on these — do not rename)
   -------------------------------------------------------------------------- */
:root {
  --porch-green: #1e5941;
  --porch-green-dark: #143d2d;
  --porch-green-light: #29704f;
  --cream: #f7f3e8;
  --cream-deep: #ede5d2;
  --paper: #fffcf5;
  --wood: #8b5e3c;
  --wood-dark: #6b462c;
  --ink: #26221b;
  --ink-soft: #554e42;
  --alert-red: #b3402e;
  --alert-red-dark: #8d3123;
  --rule: #d9cfb6;

  /* Focus ring: dark core + cream halo reads on the cream page; game.css
     swaps the two custom properties so the same ring reads on the felt. */
  --focus-core: #26221b;
  --focus-halo: #f7f3e8;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --r-pill: 999px;

  --font-serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.9375rem;  /* 15px — captions, badges */
  --fs-sm: 1rem;       /* 16px — secondary UI */
  --fs-base: 1.125rem; /* 18px — body floor for this audience */
  --fs-md: 1.25rem;
  --fs-h4: 1.25rem;
  --fs-h3: clamp(1.3rem, 1.1rem + 0.8vw, 1.6rem);
  --fs-h2: clamp(1.6rem, 1.3rem + 1.3vw, 2.1rem);
  --fs-h1: clamp(2rem, 1.55rem + 2.2vw, 2.9rem);
  --lh: 1.65;

  --wrap: 1120px;
  --measure: 68ch;
  --touch: 48px;
  --shadow-1: 0 1px 2px rgba(38, 34, 27, 0.1), 0 2px 8px rgba(38, 34, 27, 0.07);
  --shadow-2: 0 6px 22px rgba(38, 34, 27, 0.18);
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

figure {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* Plain :focus first, so browsers without :focus-visible (older iPadOS) still
   get a ring; they drop the :not(:focus-visible) rule below wholesale, which
   is exactly the fallback we want. */
a:focus,
button:focus,
input:focus,
select:focus,
summary:focus,
[tabindex]:focus {
  outline: 3px solid var(--focus-core);
  outline-offset: 2px;
  box-shadow: 0 0 0 8px var(--focus-halo);
}

a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
summary:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 var(--sp-3);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--fs-h2);
  margin-top: var(--sp-7);
}

h3 {
  font-size: var(--fs-h3);
  margin-top: var(--sp-6);
}

h4 {
  font-size: var(--fs-h4);
  margin-top: var(--sp-5);
}

p,
ul,
ol {
  margin: 0 0 var(--sp-4);
}

ul,
ol {
  padding-left: 1.35em;
}

li {
  margin-bottom: var(--sp-2);
}

small {
  font-size: var(--fs-xs);
  color: var(--ink-soft);
}

a {
  color: var(--porch-green);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

hr {
  border: 0;
  border-top: 2px solid var(--rule);
  margin: var(--sp-6) 0;
}

/* --------------------------------------------------------------------------
   4. Layout
   -------------------------------------------------------------------------- */
.site-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
}

.wrap,
.container {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--sp-4);
}

/* Pages wrap their own content; <main> already supplies the gutter. */
.site-main > .wrap,
.site-main > .container {
  padding-inline: 0;
}

/* Comfortable measure for reading. Declared after .wrap/.container so a
   element carrying both (the 404 page) keeps the measure. */
.prose {
  max-width: var(--measure);
}

.prose > :first-child {
  margin-top: 0;
}

.section {
  margin-block: var(--sp-7);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------------------
   5. Header
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: var(--sp-3) var(--sp-4);
  background: var(--ink);
  color: var(--cream);
  border-radius: 0 0 var(--r-md) 0;
}

.skip-link:focus {
  left: 0;
}

.site-header {
  background: var(--paper);
  border-bottom: 4px solid var(--wood);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2) var(--sp-4);
  min-height: 68px;
  padding-block: var(--sp-2);
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  color: var(--porch-green);
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-header__brand:hover {
  color: var(--porch-green-dark);
}

.site-header__mark {
  color: var(--alert-red);
  font-size: 1.1em;
  line-height: 1;
}

/* ---- the brand porch -----------------------------------------------------
   The spade stands on its own little porch — gable roof, a post each side, a
   deck under its feet — with the wordmark and tagline alongside. Pure CSS on
   empty spans; everything decorative is absolutely positioned inside
   .brand-porch__house, so the lockup cannot disturb the header's layout. */
.brand-porch {
  gap: var(--sp-3);
}

/* The porch mark is generated art (static/img/brand-porch.jpg), replacing the
   earlier CSS-drawn roof/posts/deck. multiply blends its near-paper background
   into the header, so no square seam can show even if the bake is a couple of
   RGB points off. */
.brand-porch__img {
  flex: none;
  width: 46px;
  height: 46px;
  mix-blend-mode: multiply;
}

.brand-porch__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.brand-porch__tagline {
  font-family: var(--font-serif);
  font-size: 12px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.2;
  color: var(--wood-dark);
  white-space: nowrap;
}

/* Tight screens: everything trims a notch but the tagline stays. */
@media (max-width: 430px) {
  .site-header__name {
    font-size: 1.35rem;
  }

  .brand-porch__img {
    width: 40px;
    height: 40px;
  }

  .brand-porch__tagline {
    font-size: 11px;
  }
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--sp-4);
  border: 2px solid var(--wood);
  border-radius: var(--r-pill);
  color: var(--porch-green-dark);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
}

.site-nav__link:hover {
  background: var(--porch-green);
  border-color: var(--porch-green-dark);
  color: var(--cream);
}

/* --------------------------------------------------------------------------
   6. Breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumb {
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
}

.breadcrumb__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--sp-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb__item {
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--ink-soft);
}

.breadcrumb__item + .breadcrumb__item::before {
  content: "\203A";
  margin: 0 var(--sp-2);
  color: var(--wood);
  font-size: 1.15em;
}

.breadcrumb__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* --------------------------------------------------------------------------
   7. Learn Euchre band — sibling-page nav at the foot of every euchre page
   -------------------------------------------------------------------------- */
.learn-nav {
  margin-block: var(--sp-7) var(--sp-4);
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
  background: var(--cream-deep);
  border: 2px solid var(--rule);
  border-left: 8px solid var(--wood);
  border-radius: var(--r-lg);
}

.learn-nav__title {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-h4);
  color: var(--porch-green-dark);
}

.learn-nav__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.learn-nav__item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: 0;
  padding: var(--sp-3);
  background: var(--paper);
  border: 2px solid var(--rule);
  border-radius: var(--r-md);
}

.learn-nav__item.is-current {
  background: var(--cream);
  border-color: var(--wood);
}

.learn-nav__link {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 700;
  text-decoration: none;
}

.learn-nav__link:hover {
  text-decoration: underline;
}

.learn-nav__blurb {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 var(--sp-5);
  border: 2px solid var(--porch-green-dark);
  border-radius: var(--r-md);
  background: var(--porch-green);
  color: var(--cream);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 140ms ease, transform 140ms ease;
}

.btn:hover {
  background: var(--porch-green-dark);
  color: var(--cream);
}

.btn:active {
  transform: translateY(1px);
}

.btn--lg {
  min-height: 60px;
  padding: 0 var(--sp-6);
  font-size: var(--fs-md);
}

.btn--secondary {
  background: var(--paper);
  border-color: var(--wood);
  color: var(--porch-green-dark);
}

.btn--secondary:hover {
  background: var(--cream-deep);
  color: var(--porch-green-dark);
}

.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   9. Prose furniture: tables, definition lists, FAQ, figures, callouts
   -------------------------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
  margin-bottom: var(--sp-5);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--sp-5);
  background: var(--paper);
  border: 2px solid var(--rule);
  font-size: var(--fs-sm);
}

caption {
  caption-side: bottom;
  padding-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  text-align: left;
}

th,
td {
  padding: var(--sp-3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

thead th {
  background: var(--porch-green);
  color: var(--cream);
  font-family: var(--font-serif);
  border-bottom: 2px solid var(--porch-green-dark);
}

tbody tr:nth-child(even) {
  background: var(--cream);
}

tbody tr:last-child td,
tbody tr:last-child th {
  border-bottom: 0;
}

dl {
  margin: 0 0 var(--sp-5);
  padding-left: var(--sp-4);
  border-left: 4px solid var(--wood);
}

dt {
  margin-top: var(--sp-4);
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--porch-green-dark);
}

dl > dt:first-child {
  margin-top: 0;
}

dd {
  margin: var(--sp-1) 0 0;
}

/* FAQ is heading + paragraph pairs, so a featured snippet can lift it. */
.faq__q {
  margin: var(--sp-5) 0 var(--sp-1);
  font-size: var(--fs-md);
  color: var(--porch-green-dark);
}

.faq__a {
  margin: 0 0 var(--sp-4);
}

/* Diagrams (the bower figure on /euchre/rules) are inline SVG in a <figure>. */
figure > svg {
  display: block;
  margin: 0 auto;
  height: auto;
}

figcaption {
  margin-top: var(--sp-3);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink-soft);
}

.callout {
  margin: var(--sp-5) 0;
  padding: var(--sp-4);
  background: var(--paper);
  border: 2px solid var(--wood);
  border-radius: var(--r-lg);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout__title {
  margin: 0 0 var(--sp-2);
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--alert-red);
}

/* --------------------------------------------------------------------------
   10. Home page: hero and tiles
   -------------------------------------------------------------------------- */
.hero {
  padding-block: var(--sp-5) var(--sp-4);
}

.hero p {
  max-width: var(--measure);
  font-size: var(--fs-md);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-block: var(--sp-5);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-4);
  list-style: none;
  margin: 0 0 var(--sp-6);
  padding: 0;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: 0;
  padding: var(--sp-4);
  background: var(--paper);
  border: 2px solid var(--rule);
  border-top: 6px solid var(--porch-green);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.tile__title {
  margin: 0;
  font-size: var(--fs-h4);
}

.tile p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}

.tile--soon {
  background: var(--cream-deep);
  border-top-color: var(--wood);
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   11. Ad slots — the macro inlines width/min-height, so the space is reserved
   before anything loads. Only the placeholder is decorated; a live unit sits
   in the same box with no border of ours around it.
   -------------------------------------------------------------------------- */
.ad-slot {
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin: var(--sp-6) auto;
}

.ad-slot__label {
  flex: 1 1 auto;
  display: grid;
  place-items: center;
  min-height: inherit;
  padding: var(--sp-2);
  background: var(--cream-deep);
  border: 2px dashed var(--rule);
  border-radius: var(--r-md);
  color: var(--ink-soft);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

/* --------------------------------------------------------------------------
   12. 404
   -------------------------------------------------------------------------- */
.error-page {
  margin-inline: auto;
  padding-block: var(--sp-6);
  text-align: center;
}

.error-page__code {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 4rem;
  line-height: 1;
  color: var(--wood);
}

.error-page__lead {
  font-size: var(--fs-md);
}

/* --------------------------------------------------------------------------
   13. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  flex: none;
  margin-top: var(--sp-7);
  padding-block: var(--sp-5);
  background: var(--porch-green-dark);
  color: var(--cream);
  border-top: 6px solid var(--wood);
}

.footer-nav__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  list-style: none;
  margin: 0 0 var(--sp-3);
  padding: 0;
}

.footer-nav__list li {
  margin: 0;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0 var(--sp-2);
  color: var(--cream);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.site-footer a:hover {
  color: #ffd766;
}

/* The ring inverts against the dark footer. */
.site-footer a:focus {
  --focus-core: #f7f3e8;
  --focus-halo: #143d2d;
}

.site-footer__note {
  margin: 0;
  max-width: var(--measure);
  font-size: var(--fs-sm);
  color: var(--cream);
}

/* --------------------------------------------------------------------------
   14. Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- language switcher (footer) ------------------------------------------
   The visible counterpart of the hreflang cluster: the same page in every
   language, current one inert. */
.lang-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin-top: var(--sp-4);
}

.lang-nav__item {
  display: inline-flex;
  align-items: center;
  min-height: var(--touch);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cream);
  text-decoration: none;
}

.lang-nav__item:hover {
  text-decoration: underline;
}

.lang-nav__item.is-current {
  color: var(--gold, #ffd766);
}
