/* jigsolitaire.com — one stylesheet, no build step, no external fonts. */

:root {
  --bg:        #fbf7f0;
  --surface:   #ffffff;
  --surface-2: #f3ede2;
  --ink:       #1f1a17;
  --ink-soft:  #5d5349;
  --ink-faint: #8b8175;
  --line:      #e5dccd;
  --brand:     #1f7a5a;
  --brand-ink: #ffffff;
  --brand-dim: #e7f2ed;
  --accent:    #d97706;
  --radius:    14px;
  --shadow:    0 1px 2px rgb(31 26 23 / 6%), 0 8px 24px rgb(31 26 23 / 6%);
  --wrap:      1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #14120f;
    --surface:   #1e1b17;
    --surface-2: #262119;
    --ink:       #f2ece2;
    --ink-soft:  #bdb3a5;
    --ink-faint: #8c8377;
    --line:      #332c24;
    --brand:     #4cbf95;
    --brand-ink: #10241d;
    --brand-dim: #1b2f28;
    --accent:    #f0a742;
    --shadow:    0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3rem); }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.9rem); }
h3 { font-size: 1.12rem; }
p  { margin: 0 0 1em; }
img { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.section { padding-block: clamp(2rem, 1rem + 3vw, 3.25rem); }
.section-sub { color: var(--ink-soft); margin-top: -.4em; }
.lede { font-size: 1.1rem; color: var(--ink-soft); }
.prose p { max-width: 68ch; }

.skip {
  position: absolute; left: -9999px;
  background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .7rem;
}

.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.brand-mark {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  width: 30px; height: 30px; flex: none;
}
.brand-mark span { background: var(--brand); border-radius: 4px; }
.brand-mark span:nth-child(2) { background: var(--accent); border-radius: 4px 9px 4px 4px; }
.brand-mark span:nth-child(3) { background: var(--accent); opacity: .55; border-radius: 4px 4px 4px 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.08rem; letter-spacing: -0.02em; }
.brand-text strong em { font-style: normal; color: var(--brand); }
.brand-text small { color: var(--ink-faint); font-size: .74rem; }
@media (max-width: 640px) { .brand-text small { display: none; } }

.lang-picker { position: relative; }
.lang-picker summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .8rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); font-size: .9rem;
}
.lang-picker summary::-webkit-details-marker { display: none; }
.lang-picker ul {
  position: absolute; right: 0; top: calc(100% + .4rem); z-index: 20;
  margin: 0; padding: .35rem; list-style: none;
  min-width: 11rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.lang-picker a {
  display: block; padding: .42rem .6rem; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-size: .92rem;
}
.lang-picker a:hover { background: var(--surface-2); }
.lang-picker a[aria-current] { color: var(--brand); font-weight: 600; }

/* ------------------------------------------------------------------ hero */

.hero {
  background: linear-gradient(180deg, var(--brand-dim), var(--bg));
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  border-bottom: 1px solid var(--line);
}
.hero h1 { max-width: 18ch; }
.hero .lede { max-width: 58ch; font-size: 1.15rem; }

.stat-band {
  display: flex; flex-wrap: wrap; gap: 1.25rem 2.5rem;
  list-style: none; margin: 1.75rem 0 0; padding: 0;
}
.stat-band li { display: flex; flex-direction: column; }
.stat-band strong { font-size: 1.6rem; letter-spacing: -0.02em; }
.stat-band span { color: var(--ink-faint); font-size: .85rem; }

/* ------------------------------------------------------------- game grid */

.game-grid { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1rem; }

.game-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
}
.rank {
  position: absolute; top: -.55rem; left: -.55rem;
  width: 1.6rem; height: 1.6rem; display: grid; place-items: center;
  background: var(--brand); color: var(--brand-ink);
  border-radius: 50%; font-size: .8rem; font-weight: 700;
}
.card-icon img, .game-icon {
  border-radius: 18px; border: 1px solid var(--line); display: block; background: var(--surface-2);
}
.card-icon img { width: 76px; height: 76px; }
.icon-placeholder {
  display: grid; place-items: center; width: 76px; height: 76px;
  background: var(--surface-2); border-radius: 18px; font-size: 2rem;
}
.icon-placeholder.small { width: 56px; height: 56px; font-size: 1.5rem; }

.card-body h3 { margin-bottom: .15em; }
.card-body h3 a { color: inherit; text-decoration: none; }
.card-body h3 a:hover { color: var(--brand); }
.dev { color: var(--ink-faint); font-size: .85rem; margin: 0 0 .4em; }
.summary { color: var(--ink-soft); margin: 0 0 .6em; font-size: .95rem; }

.facts { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: 0; }
.facts > div { display: flex; gap: .35rem; align-items: baseline; font-size: .85rem; }
.facts dt { color: var(--ink-faint); margin: 0; }
.facts dd { margin: 0; font-weight: 600; }

.card-actions { display: flex; flex-direction: column; gap: .5rem; min-width: 10rem; }

@media (max-width: 760px) {
  /* Icon sits beside the title rather than centred against tall body text. */
  .game-card { grid-template-columns: auto 1fr; align-items: start; gap: .9rem; }
  .card-icon img, .icon-placeholder { width: 60px; height: 60px; border-radius: 14px; }
  .icon-placeholder { font-size: 1.6rem; }
  .card-actions { grid-column: 1 / -1; flex-direction: row; min-width: 0; }
  .card-actions .btn { flex: 1; }
}

@media (max-width: 400px) {
  .card-actions { flex-direction: column; }
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem 1.1rem; border-radius: 10px;
  font-weight: 600; font-size: .93rem; text-decoration: none;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform .1s ease, filter .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { filter: brightness(1.08); color: var(--brand-ink); }
.btn-ghost { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--brand-dim); color: var(--ink); }
.btn-lg { padding: .8rem 1.6rem; font-size: 1rem; }

/* ----------------------------------------------------------- game detail */

.breadcrumb { padding-block: .9rem; font-size: .88rem; color: var(--ink-faint); }
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb span { margin-inline: .4rem; }

.game-hero { background: linear-gradient(180deg, var(--brand-dim), var(--bg)); border-block: 1px solid var(--line); }
.game-hero-row {
  display: flex; gap: 1.6rem; align-items: flex-start;
  padding-block: clamp(1.75rem, 1rem + 3vw, 3rem); flex-wrap: wrap;
}
.game-icon { width: 112px; height: 112px; flex: none; }
.game-hero-text { flex: 1 1 20rem; }
.game-hero-text h1 { margin-bottom: .2em; }

.spec-grid {
  display: grid; gap: 1px; margin: 0;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.spec-grid > div { background: var(--surface); padding: .9rem 1.1rem; }
.spec-grid dt { color: var(--ink-faint); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.spec-grid dd { margin: .2rem 0 0; font-size: 1.05rem; font-weight: 600; }
.spec-grid dd small { font-weight: 400; color: var(--ink-faint); font-size: .8rem; }

.cta-band {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; text-align: center; box-shadow: var(--shadow);
}
.cta-band p { max-width: 52ch; margin-inline: auto; color: var(--ink-soft); }

.related-grid {
  list-style: none; padding: 0; margin: 1.25rem 0 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
}
.related-grid a {
  display: flex; flex-direction: column; gap: .45rem; align-items: flex-start;
  padding: 1rem; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); text-decoration: none; color: inherit; height: 100%;
}
.related-grid a:hover { border-color: var(--brand); }
.related-grid img { border-radius: 14px; border: 1px solid var(--line); }
.related-name { font-weight: 600; }
.related-meta { color: var(--ink-faint); font-size: .84rem; }

/* --------------------------------------------------------- steps and FAQ */

.steps { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .85rem; }
.steps li { display: flex; gap: .9rem; align-items: flex-start; }
.step-num {
  flex: none; width: 1.9rem; height: 1.9rem; display: grid; place-items: center;
  background: var(--brand-dim); color: var(--brand); border-radius: 50%; font-weight: 700; font-size: .9rem;
}
.steps p { margin: .15rem 0 0; max-width: 62ch; }

.faq { margin-top: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.faq details { background: var(--surface); border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { cursor: pointer; padding: 1rem 1.25rem; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: inline-end; color: var(--ink-faint); font-weight: 400; }
.faq details[open] summary::after { content: "−"; }
.faq p { padding: 0 1.25rem 1.1rem; margin: 0; color: var(--ink-soft); max-width: 70ch; }

/* -------------------------------------------------------------- 404 page */

.notfound { text-align: center; padding-block: clamp(3rem, 2rem + 6vw, 6rem); }
.nf-mark { font-size: 3.5rem; margin: 0; }

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

.site-footer {
  margin-top: 2rem; padding-block: 2rem;
  background: var(--surface); border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: .88rem;
}
.footer-langs { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; margin-bottom: 1rem; }
.footer-langs ul { display: flex; flex-wrap: wrap; gap: .3rem .85rem; list-style: none; margin: 0; padding: 0; }
.disclaimer { max-width: 70ch; }
.copyright { color: var(--ink-faint); margin: 0; }

/* ------------------------------------------------------------ stats page */

.stats-page { padding-block: 2rem; }
.stats-page table {
  width: 100%; border-collapse: collapse; margin: .75rem 0 2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
}
.stats-page th, .stats-page td { text-align: left; padding: .5rem .8rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.stats-page th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.stats-page tr:last-child td { border-bottom: 0; }
.stats-cols { display: grid; gap: 0 2rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
