/* ---------------------------------------------------------------
   Blindfold Chess: The Book — site stylesheet
   A quiet, book-like design: white page, ink text, a light-gray
   navbar, a red link accent, and yellow buttons.
   --------------------------------------------------------------- */

:root {
  --paper: #ffffff;        /* page background */
  --nav-bg: #F5F5F5;       /* navbar band background */
  --ink: #23201a;
  --ink-soft: #5c564b;
  --caption-gray: #4d4d4d;  /* slightly lighter than --ink, neutral gray for captions */

  --red: #8D2B13;           /* links, site title, headlines */
  --red-dark: #6d210f;      /* link hover/focus */

  --yellow: #E7D464;        /* buttons, blockquote accent */
  --yellow-dark: #cfbe50;   /* button hover/focus */

  --green: #2f5d46;         /* retained for the footer checkerboard rule only */
  --green-dark: #234634;

  --rule: #d9d3c4;
  --divider-gray: #e0e0e0;  /* footer top divider */
  --max-width: 44rem;
}

* { box-sizing: border-box; }

html { font-size: 106.25%; } /* 17px base for comfortable long-form reading */

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* --- Footer top divider: a plain light-gray line separating the footer --- */
.footer-divider {
  height: 1px;
  background: var(--divider-gray);
}

/* --- Header / navbar --- */
/* Full-width light-gray band; the title + nav sit centered inside it at
   roughly 2x the width of the page's content column. */
.site-header {
  position: relative;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--rule);
  padding-top: 1.75rem;
  padding-bottom: 10px; /* extra breathing room above the hairline divider */
}
.site-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-bottom: 1.1rem;
  max-width: var(--max-width); /* same column width as the page content below, so the
                                    title/nav left edge lines up exactly with it */
  margin: 0 auto;
}

.site-title {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--red);
  text-decoration: none;
  line-height: 1.2;
}

/* Hamburger toggle: hidden entirely on desktop (default). See media query
   below for the small-screen behavior. */
.nav-toggle-checkbox { display: none; }
.nav-toggle-label {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.1rem;
  height: 2.1rem;
  cursor: pointer;
  order: 2;
}
.nav-toggle-label span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 1px;
}

.site-nav {
  order: 3;
  flex-basis: 100%;
  margin-top: 0.9rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.07rem;      /* ~30% larger than the original 0.82rem */
  font-weight: 400;
  letter-spacing: 0.04em;
}
.site-nav a {
  color: var(--red);
  text-decoration: none;
  margin-right: 1.1rem;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a:focus-visible { color: var(--red-dark); border-bottom-color: var(--red-dark); }
.site-nav a.nav-buy {
  color: var(--ink);
  background: var(--yellow);
  padding: 0.35rem 0.7rem;
  border-radius: 3px;
  border-bottom: none;
}
.site-nav a.nav-buy:hover,
.site-nav a.nav-buy:focus-visible { background: var(--yellow-dark); color: var(--ink); }

/* "Home" appears only in the mobile dropdown, not the desktop bar */
.nav-home-only { display: none; }

/* --- Content --- */
.content { padding: 2.25rem 1.25rem 3rem; }

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: 0.005em; }
/* All headline levels: sans-serif, body-text color (not red -- that's
   reserved for the blog listing's post-title links, styled separately below). */
h1, h2, h3, h4, .page-title {
  font-family: font-family: "Quarto A", "Quarto B", Georgia, Times, serif;
		font-style: normal;
		font-weight: 800;
		line-height: 1.1em;
  color: var(--ink);
}
.page-title {
  font-size: 1.9rem;
  margin: 0 0 0.4rem;
}
h2 { font-size: 1.35rem; margin-top: 2.2rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.15rem; }

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

/* Default: images align left rather than center */
img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.6rem auto 0.5rem 0;
}

/* Video embeds (e.g. YouTube iframes) always fit the column width,
   regardless of the fixed width/height attributes in the original embed
   code, and keep a correct 16:9 proportion as they scale. */
iframe {
  max-width: 100%;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  display: block;
  margin: 1.6rem 0;
}

/* Float-left variant: add class="img-float-left" to an <img> tag (or, in
   Markdown, ![alt](url){: .img-float-left }) to float it left at 40% of
   the column width, with ~20px of space to its right and below. */
.img-float-left {
  float: left;
  width: 40%;
  margin: 0 1.25rem 1.25rem 0; /* ~20px right and below at the base font size */
}

/* Image captions: an emphasized paragraph right after an image */
img + em, .caption {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  color: var(--caption-gray);
  text-align: left;
  margin: 0.4rem 0 1.6rem 0;
  max-width: 36rem;
}

blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--yellow);
  color: var(--ink-soft);
  font-style: italic;
}
blockquote em { font-style: normal; }

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.5rem auto;
}

/* --- Buttons (Buy the Book, Read the Introduction) --- */
.button {
  display: inline-block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--yellow);
  text-decoration: none;
  padding: 0.6rem 1.1rem;
  border-radius: 3px;
  margin: 0.4rem 0.6rem 0.4rem 0;
}
.button:hover, .button:focus-visible { background: var(--yellow-dark); color: var(--ink); }

/* --- Blog index --- */
.post-list { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.post-list li {
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-list .post-link {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--red);
}
.post-list .post-link:hover { color: var(--red-dark); text-decoration: underline; }
.post-list .post-meta { margin: 0.25rem 0 0; }

.post-meta {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
}

.post-back {
  margin-top: 2.5rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 700;
}

/* --- Contact form --- */
.contact-form { margin-top: 1.5rem; max-width: 34rem; }
.contact-form label {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1rem 0 0.3rem;
}
.contact-form input,
.contact-form textarea {
  width: 100%;
  font: inherit;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
}
.contact-form input:focus,
.contact-form textarea:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.contact-form button { margin-top: 1.2rem; border: none; cursor: pointer; }

/* --- Footer --- */
.site-footer { margin-top: 2rem; }
.site-footer .wrap { padding: 1.6rem 1.25rem 2.2rem; }
.footer-title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 700;
  margin: 0 0 0.3rem;
}
.footer-icon { font-size: 2em; vertical-align: middle; }
.footer-nav, .footer-copy {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 0.2rem 0;
}
.footer-nav a { color: var(--ink-soft); text-decoration: none; }
.footer-nav a:hover { color: var(--red-dark); text-decoration: underline; }

/* --- Small screens: collapse the nav into a dropdown --- */
@media (max-width: 640px) {
  html { font-size: 100%; }

  /* Hamburger moves to the left of the title on mobile, with a gap between
     them, instead of trying to sit at the far right of a row that's now
     left-aligned (which left it crashing into the title text). */
  .nav-toggle-label {
    display: flex;
    order: -1;
    margin-right: 0.75rem;
  }
  .site-title { font-size: 1.2rem; }

  .site-nav {
    display: none;
    flex-direction: column;
    gap: 0;
    margin-top: 0;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem 1.25rem 0.75rem;
    z-index: 20;
  }
  .nav-toggle-checkbox:checked ~ .site-nav { display: flex; }

  .nav-home-only { display: block; }

  .site-nav a {
    margin: 0;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--rule);
  }
  .site-nav a:last-of-type { border-bottom: none; }
  .site-nav a.nav-buy {
    display: inline-block;
    margin-top: 0.6rem;
    text-align: center;
  }

  /* Floating images don't have room to float on narrow screens */
  .img-float-left {
    float: none;
    width: 100%;
    margin: 1.6rem auto 0.5rem 0;
  }
}

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