/* Gallipoli war diaries index. Plain CSS, no framework.
   Colours and type follow littlegully.com (astro-lgp tailwind.config.mjs). */

@font-face {
  font-family: 'Crimson Pro';
  src: url('/assets/fonts/CrimsonPro-Regular.woff2') format('woff2');
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Crimson Pro';
  src: url('/assets/fonts/CrimsonPro-Italic.woff2') format('woff2');
  font-weight: 200 900; font-style: italic; font-display: swap;
}

:root {
  --paper: #fffff8;
  --text: #2d3748;
  --muted: #5b6676;
  --primary: #b58555;
  --link: #8a6238;        /* primary, darkened to pass contrast on paper */
  --secondary: #4a645f;
  --accent-red: #8e0d0d;
  --gold: #c99c5a;
  --slate: #2d3748;
  --tint: #f7f6f0;
  --rule: #e5e7eb;
  --max: 68rem;
  --serif: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--text); font-family: var(--sans); font-size: 1rem; line-height: 1.55; }

a { color: var(--link); }
a:hover { color: var(--accent-red); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

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

.wrapper, .inner { max-width: var(--max); margin: 0 auto; padding-left: 1rem; padding-right: 1rem; }

.site-header { background: var(--slate); color: #fff; border-bottom: 4px solid var(--gold); }
.site-header .inner { padding-top: 1.4rem; padding-bottom: 1.1rem; }
.site-title { font-family: var(--serif); font-size: 2.1rem; font-weight: 700; line-height: 1.15; margin: 0; }
.site-title a { color: #fff; text-decoration: none; }
.site-tagline { margin: 0.3rem 0 0; color: #d8dde5; font-size: 0.95rem; }
.site-header a:focus-visible { outline-color: #fff; }

.intro { font-family: var(--serif); font-size: 1.25rem; line-height: 1.5; max-width: 46rem; margin: 1.5rem 0 1.25rem; }
.intro p { margin: 0 0 0.7em; }

.controls {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 0.75rem;
  background: var(--tint); border: 1px solid var(--rule); border-radius: 0.5rem; padding: 0.75rem;
}
.field { min-width: 0; }
.field label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--secondary); margin-bottom: 0.2rem; }
.field input, .field select {
  width: 100%; font: inherit; color: inherit; background: #fff;
  border: 1px solid #cfd4da; border-radius: 0.375rem; padding: 0.5rem 0.6rem; height: 2.6rem;
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }

.results-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; margin: 0.75rem 0 0.5rem; }
.count { color: var(--muted); font-size: 0.9rem; margin: 0; }
a.download { font-size: 0.9rem; }
a.download[hidden] { display: none; }
button.linklike { font: inherit; color: var(--link); background: none; border: 0; padding: 0; margin-left: 0.75rem; cursor: pointer; text-decoration: underline; }
button.linklike:hover { color: var(--accent-red); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--secondary); border-bottom: 2px solid var(--secondary); padding: 0.4rem 0.6rem; }
td { padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
tbody tr:hover { background: var(--tint); }
tr[hidden] { display: none; }
.ref { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.diary { display: block; font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; font-weight: 600; }
.sub { display: block; font-size: 0.82rem; color: var(--muted); }
.dates { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.links { white-space: nowrap; }
.links a { display: inline-block; font-size: 0.9rem; }
.links a.anc {
  background: var(--secondary); color: #fff; text-decoration: none;
  padding: 0.2rem 0.65rem; border-radius: 0.3rem; margin-right: 0.6rem; font-weight: 600;
}
.links a.anc:hover { background: var(--slate); color: #fff; }

.empty { background: var(--tint); border-left: 4px solid var(--gold); padding: 0.75rem 1rem; }
.notes { max-width: 46rem; margin: 2.5rem 0 0; }
.notes h2 { font-family: var(--serif); font-size: 1.6rem; margin: 0 0 0.5rem; }
.notes p { margin: 0 0 0.8em; }

.site-footer { background: var(--slate); color: #d8dde5; margin-top: 3rem; font-size: 0.9rem; }
.site-footer .inner { padding-top: 1.5rem; padding-bottom: 2rem; }
.site-footer p { margin: 0 0 0.6em; max-width: 46rem; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--gold); }

.site-footer button.linklike { color: #fff; margin-left: 0; }
.site-footer button.linklike:hover { color: var(--gold); }

h1 { font-family: var(--serif); font-size: 2rem; line-height: 1.2; margin: 0 0 0.6rem; }

/* Cookie choice */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem;
  background: var(--tint); border-top: 1px solid #cfd4da; box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  padding: 0.9rem 1rem;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; font-size: 0.9rem; line-height: 1.5; max-width: 46rem; }
.cookie-buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cookie-buttons button {
  font: inherit; font-size: 0.9rem; padding: 0.45rem 1rem; border-radius: 0.375rem; cursor: pointer;
  border: 1px solid var(--secondary); background: #fff; color: var(--secondary);
}
.cookie-buttons button#cookie-accept { background: var(--secondary); color: #fff; }

@media (max-width: 56rem) {
  .controls { grid-template-columns: 1fr 1fr; position: static; }
  .field-q { grid-column: 1 / -1; }
}
@media (max-width: 40rem) {
  .site-title { font-size: 1.7rem; }
  .intro { font-size: 1.15rem; }
  thead { display: none; }
  tbody tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
  td { display: inline-block; border: 0; padding: 0.1rem 0.6rem 0.1rem 0; }
  td:nth-child(2), td.links { display: block; }
  td.links { padding-top: 0.4rem; }
  .dates { white-space: normal; }
}
@media print {
  .controls, .skip-link, .count button, a.download, .cookie-banner, .site-footer button { display: none; }
  .site-header, .site-footer { background: none; color: #000; border: 0; }
  .site-title a, .site-footer a { color: #000; }
}
