@charset "UTF-8";
/* =========================================================
   styles.css — Triad Website starter stylesheet
   Mobile-first: the base styles are for phones.
   Media queries at the bottom add tablet and desktop changes.
   ========================================================= */

/* ===== 1. DESIGN TOKENS =====
   Copy these values from your Figma style guide.
   Change them here once and the whole site updates. */
:root {
  --color-bg: #fbfaf7;
  --color-surface: #efe9df;
  --color-text: #22201c;
  --color-accent: #2e6b3a;
  --color-topic-1: #d9480f;
  --color-topic-2: #c2185b;
  --color-topic-3: #b3261e;

  --font-heading: 'DM Serif Display', Georgia, serif;
  --font-body: 'Work Sans', Arial, sans-serif;

  --space: 16px;
  --max-width: 1080px;
}

/* ===== 2. BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;     /* padding no longer adds to an element's width */
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;            /* 1rem = 16px */
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
}

img {
  max-width: 100%;            /* images never overflow their container */
  height: auto;
  display: block;
}

a {
  color: var(--color-accent);
}

/* ===== 3. TYPOGRAPHY ===== */
h1, h2, h3 {
  font-family: var(--font-heading);
  line-height: 1.2;
  margin: 0 0 0.5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  max-width: 65ch;            /* keeps lines to a readable length */
  margin: 0 0 1em;
}

/* ===== 4. LAYOUT CONTAINER ===== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;             /* centers the content */
  padding: 0 var(--space);
}

/* ===== 5. HEADER AND NAVIGATION ===== */
.site-header {
  background-color: var(--color-surface);
  padding: var(--space) 0;
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
}

.logo img {
  height: 56px;
  width: auto;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

nav a {
  display: block;
  min-height: 44px;           /* big enough to tap on a phone */
  padding: 10px 16px;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-text);
  background-color: var(--color-bg);
  border-radius: 4px;
}

nav a:hover,
nav a:focus-visible {
  color: #ffffff;
  background-color: var(--color-accent);
}

nav a[aria-current="page"] {  /* the page you are on */
  color: var(--color-bg);
  background-color: var(--color-text);
}

/* ===== 6. HOME PAGE ===== */
.intro {
  padding: 32px 0;
}

.topics {
  display: grid;
  /* Fluid grid: as many columns as fit, each at least 250px wide.
     Phone = 1 column, tablet = 2, desktop = 3. No media query needed. */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}

.topic-card {
  background-color: var(--color-surface);
  border-top: 6px solid var(--topic-color, var(--color-accent));
}

.topic-card a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.topic-card h2,
.topic-card p {
  padding: 0 var(--space);
}

.topic-card h2 {
  margin-top: var(--space);
}

.topic-1 { --topic-color: var(--color-topic-1); }
.topic-2 { --topic-color: var(--color-topic-2); }
.topic-3 { --topic-color: var(--color-topic-3); }

/* ===== 7. GALLERY PAGES ===== */
.gallery-page {
  display: grid;
  gap: 24px;
  padding-block: 32px;        /* top and bottom only, so the side gutter stays */
}

.gallery-page .intro {
  padding: 0;                 /* the gallery-page already adds the space */
}

.gallery {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  /* Fluid grid: as many columns as fit, each at least 160px wide.
     The browser adds or removes columns as the screen changes size. */
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 1 / 1;        /* keeps every thumbnail square */
  object-fit: cover;
  transition: transform 0.3s;
}

.gallery a:hover img,
.gallery a:focus-visible img {
  transform: scale(1.04);
}

.gallery a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* ===== 8. FOOTER ===== */
.site-footer {
  margin-top: 48px;
  padding: 24px 0;
  font-size: 0.875rem;
  background-color: var(--color-surface);
}

/* ===== 9. LIGHTBOX (used by js/gallery.js) ===== */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 92vw;
  max-height: 92vh;
  overflow: visible;
}

.lightbox::backdrop {
  background-color: rgba(0, 0, 0, 0.88);
}

.lightbox img {
  max-height: 80vh;
  width: auto;
  margin: 0 auto;
}

.lightbox figure {
  margin: 0;
}

.lightbox figcaption {
  color: #ffffff;
  text-align: center;
  padding: 12px 56px;
}

.lightbox button {
  position: fixed;
  width: 48px;
  height: 48px;
  font-size: 2rem;
  line-height: 1;
  color: #ffffff;
  background-color: rgba(0, 0, 0, 0.6);
  border: 2px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox button:hover,
.lightbox button:focus-visible {
  color: #000000;
  background-color: #ffffff;
}

.lb-close { top: 16px; right: 16px; }
.lb-prev  { top: 50%; left: 12px; }
.lb-next  { top: 50%; right: 12px; }

/* ===== 10. TABLET: 600px and wider ===== */
@media (min-width: 600px) {
  :root { --space: 24px; }

  h1 { font-size: 2.5rem; }
}

/* ===== 11. DESKTOP: 1000px and wider ===== */
@media (min-width: 1000px) {
  :root { --space: 40px; }

  .gallery-page {
    /* Text column + gallery. In Figma the text column is 280px of 1080px;
       2fr 5fr keeps that proportion but lets both columns flex. */
    grid-template-columns: 2fr 5fr;
    gap: 40px;
    align-items: start;
  }
}

/* Turns off movement for visitors who ask their device for less motion */
@media (prefers-reduced-motion: reduce) {
  .gallery img { transition: none; }
}

/* Example only: link back to the guide */
.guide-banner { max-width: none; margin: 0; padding: 8px 16px; font-size: 0.875rem; text-align: center; background: var(--color-text); color: var(--color-bg); }
.guide-banner a { color: inherit; font-weight: 600; }
