/* Shared styles for alexbahia.com. Plain CSS, no build step.
   Theme taken from Alex's poetry page: a paper sheet on a desk, EB Garamond text, Courier Prime labels. */
@import url("chrome.css");
:root {
  --bg: #E7E0CF;          /* poetry: --desk */
  --surface: #FBF8F1;     /* poetry: --sheet */
  --text: #211C17;        /* poetry: --ink */
  --text-2: #4F463C;      /* poetry: --ink2 */
  --muted: #665C50;       /* poetry: --muted, darkened for contrast */
  --accent: #A3241A;      /* poetry: --red */
  --accent-soft: #F0D8CE; /* poetry: --wash */
  --border: #E2D8C6;      /* poetry: --rule */
  --shadow: rgba(60, 40, 20, .38);
  --radius: 2px;
  --max: 1360px;          /* the shared card width (assets/chrome.css .ab-card) */
  --font: 'EB Garamond', 'Shippori Mincho', 'Noto Serif Ethiopic', Georgia, 'Times New Roman', serif;
  --serif: var(--font);
  --mono: 'Courier Prime', 'Courier New', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120E; --surface: #221E19; --text: #ECE4D4; --text-2: #CFC5B3; --muted: #A99D8B;
    --accent: #E5735E; --accent-soft: #52302A; --border: #3B342B; --shadow: rgba(0, 0, 0, .7); color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 19px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
/* The page body is one sheet of paper on the desk: the shared .ab-card in chrome.css (same on every page). */
.wrap { width: calc(100% - 32px); max-width: var(--max); margin: 0 auto; padding-left: 64px; padding-right: 64px; }
main.ab-card { background: var(--surface); }
/* Reading measure inside the wide card */
main.ab-card > p, main.ab-card > ul, main.ab-card > ol, main.ab-card > section > p, .mref p, .mref > ul, .mref > ol { max-width: 46rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.25; }
h1 { font-size: 2.1rem; margin: 0 0 1rem; }
h2 { font-size: 1.45rem; margin: 2rem 0 0.75rem; }
h3 { font-size: 1.15rem; margin: 0 0 0.5rem; }
a { color: var(--accent); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: #fff; padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* Section sub-nav (Lunde | Lundiyani | Lexicon), styled like the poetry page's menu */
.sub-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 22px; }
.sub-nav a {
  display: inline-block; padding: 6px 0; border-bottom: 1px solid transparent;
  font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
}
.sub-nav a:hover { color: var(--text); }
.sub-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.sub-nav { margin: 0 0 1.5rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.breadcrumb { margin: 0 0 0.5rem; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.breadcrumb a { color: var(--muted); }

/* Cards */
.cards, .halves { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.halves { margin-top: 1.5rem; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
}
.card h2 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.plain { list-style: none; padding: 0; margin: 0.75rem 0 0; }
.plain li { margin: 0.25rem 0; }

/* Placeholder marker: remove once real content lands */
.placeholder {
  color: var(--muted); font-style: italic;
  border-left: 3px solid var(--border); padding-left: 0.75rem;
}

.site-footer { color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: .08em; }
.site-footer .wrap { background: none; padding-top: 0; padding-bottom: 24px; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }

/* Phones */
@media (max-width: 640px) {
  body { font-size: 18px; }
  h1 { font-size: 1.7rem; }
  .wrap { padding-left: 22px; padding-right: 22px; }
}

/* Gallery */
.lead { color: var(--muted); max-width: 42rem; }
.gallery-toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0 1rem;
}
.gallery-toc h2 { font-size: 12px; margin: 0 0 0.5rem; font-family: var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
.gallery-toc ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: 0.95rem;
}
.gallery-toc .count { color: var(--muted); font-size: 0.85rem; }
.lang-section { padding-top: 1rem; border-top: 1px solid var(--border); margin-top: 2rem; scroll-margin-top: 1rem; }
.lang-section h2 { margin-top: 0.5rem; }
.lang-note { color: var(--muted); font-size: 0.95rem; margin: -0.25rem 0 0.5rem; }
/* Optional per-language context block */
.lang-context {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.6rem 0.9rem; margin: 0.5rem 0 1rem; color: var(--text); max-width: 42rem;
}
.gallery-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
}
.gallery-item {
  margin: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.gallery-item a { display: block; background: var(--bg); }
.gallery-item img {
  display: block; width: 100%; height: 14rem; object-fit: contain;
  transition: opacity 0.15s;
}
.gallery-item a:hover img { opacity: 0.85; }
.gallery-item figcaption { padding: 0.5rem 0.7rem 0.6rem; font-size: 0.875rem; line-height: 1.4; color: var(--muted); }
@media (max-width: 40rem) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .gallery-item img { height: 11rem; }
  .gallery-item figcaption { font-size: 0.8rem; padding: 0.4rem 0.5rem; }
}

/* Gallery photo viewer (built by the script on the gallery page) */
html.lb-open { overflow: hidden; }
.lb {
  position: fixed; inset: 0; z-index: 100; background: rgba(21, 18, 14, .92);
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center;
}
.lb[hidden] { display: none; }
.lb-fig { margin: 0; grid-column: 2; display: grid; justify-items: center; gap: 10px; max-height: 100vh; padding: 56px 0 20px; }
.lb-img { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; background: #FBF8F1; box-shadow: 0 24px 44px -24px rgba(0, 0, 0, .7); }
.lb-cap { color: #ECE4D4; font-family: var(--font); font-size: 17px; text-align: center; padding: 0 8px; }
.lb-n { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; color: #A99D8B; margin-right: .5em; }
.lb button {
  background: none; border: 0; color: #ECE4D4; cursor: pointer; font-family: var(--font); line-height: 1;
  min-width: 48px; min-height: 48px; border-radius: 2px;
}
.lb button:hover { color: #E5735E; }
.lb button:focus-visible { outline: 2px solid #E5735E; outline-offset: 2px; }
.lb-prev, .lb-next { font-size: 56px; }
.lb-prev { grid-column: 1; grid-row: 1; justify-self: center; }
.lb-next { grid-column: 3; grid-row: 1; justify-self: center; }
.lb-close { position: absolute; top: 8px; right: 8px; font-size: 40px; }
@media (max-width: 640px) {
  .lb { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .lb-fig { padding: 60px 8px 84px; }
  .lb-img { max-height: calc(100vh - 170px); }
  .lb-prev, .lb-next { position: absolute; bottom: 14px; font-size: 44px; background: rgba(0, 0, 0, .35); }
  .lb-prev { left: 16px; } .lb-next { right: 16px; }
}
