/* ==========================================================================
   Colors: change them here. Light theme first, then dark.
   Brand colors come straight from the AS logo. The exact blue (#1889b1) is used
   for large headings, borders and fills; text-sized links use a deeper shade of
   the same blue so they meet WCAG AA contrast (4.5:1).
   ========================================================================== */
:root {
  --brand-blue: #1889b1;
  --brand-blue-deep: #0e6585;   /* same hue, darker: for small text on light bg */
  --brand-yellow: #fdcf66;
  --ink: #1a1a1a;               /* text placed on yellow or blue fills */

  --bg: #fffdf7;
  --text: #1a1a1a;
  --muted: #4a4a4a;
  --heading: var(--brand-blue);
  --link: var(--brand-blue-deep);
  --link-hover: var(--text);
  --surface: #f4f1ea;           /* neutral backdrop behind artwork */
  --border: #d9d4c7;
  --focus: var(--text);
  --accent-line: var(--brand-blue);

  color-scheme: light;
}

/* Dark theme values, used for the device setting AND the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414;
    --text: #f2f0eb;
    --muted: #b8b8b8;
    --heading: var(--brand-blue);
    --link: var(--brand-yellow);
    --link-hover: #fff;
    --surface: #1f1f1f;
    --border: #3a3a3a;
    --focus: var(--brand-yellow);
    --accent-line: var(--brand-yellow);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141414;
  --text: #f2f0eb;
  --muted: #b8b8b8;
  --heading: var(--brand-blue);
  --link: var(--brand-yellow);
  --link-hover: #fff;
  --surface: #1f1f1f;
  --border: #3a3a3a;
  --focus: var(--brand-yellow);
  --accent-line: var(--brand-yellow);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
}

main { flex: 1; padding-block: 2.5rem 4rem; }
main:focus { outline: none; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.75rem; }
h1 { color: var(--heading); font-size: clamp(2rem, 1.4rem + 2.5vw, 3rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.9rem); margin-top: 2.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; max-width: 65ch; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 0.15em; }

img { max-width: 100%; height: auto; display: block; }

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

.wrap { width: min(100% - 2.5rem, 72rem); margin-inline: auto; }

.lead { font-size: 1.25rem; color: var(--muted); }
.muted { color: var(--muted); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Skip link: hidden until it gets keyboard focus */
.skip-link {
  position: absolute;
  left: 1rem; top: -100%;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--brand-yellow);
  color: var(--ink);
  font-weight: 700;
}
.skip-link:focus { top: 1rem; outline-color: var(--ink); }

/* ==========================================================================
   Header + navigation
   ========================================================================== */
.site-header {
  background: var(--bg);
  border-top: 0.4rem solid var(--brand-blue);
  border-bottom: 2px solid var(--border);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2rem;
  padding-block: 0.9rem;
}
.site-header a { color: var(--text); text-decoration: none; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font-weight: 700;
  font-size: 1.2rem;
  margin-right: auto;
}
/* Original AS logo (black lettering) in light mode; a copy with off-white
   lettering in dark mode. The blue and yellow are unchanged in both. */
.brand-logo { width: 9.75rem; height: auto; }
.logo-on-dark { display: none; }
:root[data-theme="dark"] .logo-on-light { display: none; }
:root[data-theme="dark"] .logo-on-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none; }
  :root:not([data-theme="light"]) .logo-on-dark { display: block; }
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 0.6rem;
  font-weight: 600;
  border-bottom: 0.2rem solid transparent;
}
.nav-list a:hover { border-bottom-color: var(--border); }
.nav-list a[aria-current] { border-bottom-color: var(--accent-line); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 2px solid var(--text);
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--brand-blue); }
.theme-toggle[hidden] { display: none; }
.theme-icon {
  width: 1rem; height: 1rem;
  border-radius: 50%;
  background: var(--brand-yellow);
  border: 1px solid var(--text);
  box-shadow: inset -0.35rem -0.1rem 0 0 var(--bg);
}
.theme-toggle[aria-pressed="true"] .theme-icon { box-shadow: none; }

/* ==========================================================================
   Home intro
   ========================================================================== */
.intro { padding-block: 0.5rem 0; }
.intro h1 { max-width: 22ch; margin-bottom: 0.4rem; }
.intro p { color: var(--muted); font-size: 1.1rem; margin: 0; }
.more-link { margin-top: 2rem; font-weight: 600; }

/* ==========================================================================
   Gallery wall: rows of photos at their natural shapes (no cropping).
   Each item grows in proportion to its width/height ratio (--r), so every
   photo in a row ends up the same height. Order stays left to right.
   ========================================================================== */
.wall {
  --row-h: 11rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
}
@media (min-width: 40rem) { .wall { --row-h: 15rem; gap: 1rem; } }
@media (min-width: 72rem) { .wall { --row-h: 18rem; } }
/* Invisible spacer so the last row isn't stretched to full width. */
.wall::after { content: ""; flex: 999 1 0; }
/* js/wall.js balances the rows when JavaScript is available. */
.wall.is-justified::after { display: none; }

.wall-item {
  flex: var(--r) 1 calc(var(--r) * var(--row-h));
  max-width: calc(var(--r) * var(--row-h) * 1.6); /* no single photo gets blown up */
  min-width: 0;
}
.wall-link { display: block; color: var(--muted); text-decoration: none; }
.wall-media {
  display: block;
  aspect-ratio: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.wall-media picture { display: block; height: 100%; }
.wall-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.wall-link:hover .wall-media img { transform: scale(1.025); }
.wall-title { display: block; margin-top: 0.4rem; font-size: 0.95rem; }
.wall-link:hover .wall-title { color: var(--link); text-decoration: underline; }

/* Image boxes used on the Projects page */
.card-media { display: block; background: var(--surface); overflow: hidden; aspect-ratio: 16 / 10; }
.card-media picture { display: block; height: 100%; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }

/* Single artwork page */
.artwork { margin: 0; }
.artwork-frame {
  background: var(--surface);
  padding: clamp(0.5rem, 2vw, 1.5rem);
}
.artwork-frame img {
  width: auto;
  max-height: 80vh;
  margin-inline: auto;
}
.artwork figcaption { margin-top: 1.25rem; }
.artwork figcaption h1 { margin-bottom: 0.25rem; }

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--border);
}
.pager ul { display: contents; list-style: none; }
.pager a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
}

/* ==========================================================================
   Projects
   ========================================================================== */
.projects { display: grid; gap: 2.5rem; list-style: none; padding: 0; margin: 2rem 0 0; }
.project {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  align-items: start;
}
.project h2 { margin-top: 0; }
.tag {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.1rem 0.55rem;
  background: var(--brand-yellow);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding-block: 1.5rem;
  border-top: 2px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}
.site-footer p { margin: 0.25rem 0; max-width: none; }

/* ==========================================================================
   Accessibility preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .nav-list a[aria-current] { border-bottom-color: Highlight; }
  .tag { border: 1px solid; }
}
