/* Original Colours:
  --bg: #0f0f10;
  --muted: #dcdcdc;
  --accent: #f5f5f5;
*/

:root {
  --bg: #030316; /* Main page background. */
  --surface: #0b0b22; /* Elevated surfaces such as the mobile navigation. */
  --muted: #dcdcdc; /* Default body text and outline button text. */
  --accent: #fffbfb; /* Headings, links, controls, and primary buttons. */
  --button-text: #222222; /* Text placed on solid accent buttons. */
  --image-text: #ffffff; /* Text over feature images. */
  --secondary-text: #bfbfbf; /* Supporting copy and page introductions. */
  --subtle-text: #9c9c9c; /* Captions, footer text, and low-priority controls. */
  --panel: #1b1b1c; /* Image, input, and placeholder panel backgrounds. */
  --border: rgba(255, 255, 255, 0.2); /* Standard borders around controls and media. */
  --border-subtle: rgba(255, 255, 255, 0.04); /* Quiet separators, especially in the footer. */
  --control-hover: rgba(255, 255, 255, 0.08); /* Hover backgrounds for navigation and icons. */
  
  --page-gutter: 20px;
  --border-radius: 6px;
  --border-radius-card: 8px;
  --transition-smooth: 0.2s ease;
}

html[data-theme="light"] {
  --bg: #f6f3ed;
  --surface: #fffdf8;
  --muted: #51483f;
  --accent: #1d1915;
  --button-text: #ffffff;
  --image-text: #ffffff;
  --secondary-text: #675e55;
  --subtle-text: #766d64;
  --panel: #e5e0d8;
  --border: rgba(55, 45, 35, 0.2);
  --border-subtle: rgba(55, 45, 35, 0.14);
  --control-hover: rgba(55, 45, 35, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

html {
  color-scheme: dark;
  scrollbar-color: var(--subtle-text) var(--bg);
}

html[data-theme="light"] {
  color-scheme: light;
  scrollbar-color: var(--subtle-text) var(--bg);
}

body {
  font-size: clamp(1rem, 0.9rem + 0.3vw, 1.125rem);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--muted);
  font-family: Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1280px; width: calc(100% - (var(--page-gutter) * 2)); margin: 0 auto; }
header { background: transparent; }
.header-inner { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; }
.site-title { text-decoration: none; }
.site-title h1 { margin: 0; color: var(--accent); font-size: 1.2rem; }

#nav-toggle { position: relative; display: none; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--accent); cursor: pointer; }
.nav-toggle__line { position: absolute; top: 50%; left: 50%; display: block; width: 26px; height: 2px; margin: 0; border-radius: 999px; background: var(--accent); transform: translate(-50%, -50%); transform-origin: center; transition: transform 0.2s ease, opacity 0.2s ease; }
.nav-toggle__line:nth-child(1) { transform: translate(-50%, calc(-50% - 10px)); }
.nav-toggle__line:nth-child(3) { transform: translate(-50%, calc(-50% + 10px)); }
#nav-toggle:hover { background: var(--control-hover); }
#nav-toggle:focus-visible, .feature-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(1) { transform: translate(-50%, -50%) rotate(45deg); }
#nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(2) { opacity: 0; }
#nav-toggle[aria-expanded="true"] .nav-toggle__line:nth-child(3) { transform: translate(-50%, -50%) rotate(-45deg); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
nav { display: flex; gap: 0.35rem; }
nav a { padding: 0.45rem 0.7rem; border: 1px solid transparent; border-radius: var(--border-radius); color: var(--accent); text-decoration: none; white-space: nowrap; transition: var(--transition-smooth), border-color var(--transition-smooth); }
.nav-label-short { display: none; }
nav a:hover { background: var(--control-hover); }
nav a:focus-visible { border-color: var(--border); background: var(--control-hover); }
nav a.nav-newsletter { border-color: rgba(202, 169, 106, 0.65); color: #e2c98e; }
nav a.nav-newsletter:hover { background: rgba(202, 169, 106, 0.12); }
nav a.nav-newsletter:focus-visible { border-color: #e2c98e; background: rgba(202, 169, 106, 0.12); }

@media (max-width: 76rem) and (min-width: 62.01rem) {
  .nav-label-full { display: none; }
  .nav-label-short { display: inline; }
}

.button { display: inline-block; margin-top: 1rem; padding: 1rem 1.6rem; border-radius: var(--border-radius); background: var(--accent); color: var(--button-text); font-weight: 600; text-decoration: none; transition: all var(--transition-smooth); }
.button--secondary { border: 1px solid var(--border); background: transparent; color: var(--muted); }
.button:hover, .button-outline:hover { opacity: 0.85; }
.button--secondary:hover { background: var(--control-hover); color: var(--accent); }
.button-outline, .content a.button-outline { margin-left: 0.5rem; border: 1px solid var(--border); background: transparent; color: var(--muted) !important; }

body > main { position: relative; flex: 1 0 auto; background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent); }
.content { flex: 1; padding: 2rem 0; }
.content article { color: var(--muted); line-height: 1.6; }
.content a { color: var(--accent); text-underline-offset: 0.18em; }
.content a.button { color: var(--button-text); text-decoration: none; }
.content a.button--secondary { color: var(--muted); }
.content section { margin: 0 0 2.75rem; }
.content h3 { margin: 0 0 0.6rem; color: var(--accent); font-size: 1.45rem; line-height: 1.25; }

.carousel-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.75rem; margin-top: 2rem; }
.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(min(28rem, 82%), 1fr); gap: 1rem; margin: 0; padding: 0 0.1rem; overflow-x: auto; scrollbar-width: none; touch-action: pan-y; user-select: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel.is-dragging { cursor: grabbing; }
.carousel__item { min-width: 0; margin: 0; }
.carousel__image { display: block; width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: var(--border-radius-card); background: var(--panel); box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.24); object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.carousel__caption { margin-top: 0.45rem; color: var(--subtle-text); font-size: 0.88rem; }
.carousel__button { display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--subtle-text); cursor: pointer; font: inherit; font-size: 1.6rem; line-height: 1; opacity: 0.7; transition: color var(--transition-smooth), background var(--transition-smooth), opacity var(--transition-smooth); }
.carousel__button:hover, .carousel__button:focus-visible { background: rgba(255, 255, 255, 0.05); color: var(--accent); opacity: 1; }

.page-intro { margin-bottom: 2.5rem; padding-bottom: 1rem; border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.page-intro h2 { margin: 0; color: var(--accent); font-size: clamp(2rem, 5vw, 2.4rem); }
.page-intro p { margin: 0.5rem 0 0; color: var(--secondary-text); }
.section-kicker { margin: 0 0 0.4rem; color: #caa96a; font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }

.work-list { display: grid; gap: 2rem; }
.work-item { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; align-items: start; gap: 1.5rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.work-item:last-child { padding-bottom: 0; border-bottom: 0; }
.work-item img { display: block; width: 100%; aspect-ratio: 3 / 4; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: var(--border-radius-card); background: #1b1b1c; box-shadow: 0 0.75rem 1.75rem rgba(0, 0, 0, 0.24); object-fit: cover; }
.link-list { padding-left: 1.2rem; }
.link-list li { margin: 0.7rem 0; }

.site-footer { flex-shrink: 0; margin-top: 2rem; padding: 1rem 0; border-top: 1px solid var(--border-subtle); color: var(--subtle-text); }
.site-footer .container { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.site-footer p { margin: 0; }
.site-footer__links { display: contents; }
.site-footer a { text-underline-offset: 0.18em; }
.social-links { display: flex; justify-content: center; gap: 0.85rem; }
.social-links a { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; text-decoration: none; transition: color var(--transition-smooth), background var(--transition-smooth); }
.social-links a:hover, .social-links a:focus-visible { background: var(--control-hover); color: var(--accent); }
.social-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.social-links img { width: 1.25rem; height: 1.25rem; object-fit: contain; filter: invert(1); }
html[data-theme="light"] .social-links img { filter: none; }
.theme-toggle { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.theme-toggle { justify-self: end; }
.theme-toggle:hover, .theme-toggle:focus-visible { color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 62rem) {
  #nav-toggle { display: grid; }
  nav {
    position: absolute;
    z-index: 10;
    top: calc(100% + 0.25rem);
    right: 0;
    display: flex;
    flex-direction: column;
    min-width: min(19rem, calc(100vw - 2.5rem));
    padding: 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38);
    gap: 0.35rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
  }
  nav.open { max-height: 500px; opacity: 1; }
  nav a {
    display: block;
    padding: 0.9rem 0.85rem;
    min-height: 46px;
    color: var(--accent);
    border-radius: var(--border-radius);
    transition: background var(--transition-smooth);
  }
  nav a.nav-newsletter { border-color: rgba(202, 169, 106, 0.65); }
  nav a:hover, nav a:focus { background: var(--control-hover); }
}

@media (max-width: 44rem) {
  :root { --page-gutter: 16px; }
  .content { padding: 1.5rem 0; }
  .content section { margin-bottom: 2.25rem; }
  .page-intro { margin-bottom: 2rem; }
  .page-intro h2 { font-size: 2rem; line-height: 1.1; }
  .content h3 { font-size: 1.3rem; }
  .carousel-wrap { gap: 0.5rem; margin-top: 1.5rem; }
  .carousel { gap: 1.25rem; }
  .carousel__button { width: 1.8rem; height: 1.8rem; font-size: 1rem; }
  .work-list { gap: 1.5rem; }
  .work-item { grid-template-columns: 1fr; gap: 1.1rem; padding-bottom: 1.5rem; }
  .work-item img,
  .work-item .volume-item__cover { width: min(100%, 20rem); margin-inline: auto; }
  .work-item > div:not(.volume-item__cover) { min-width: 0; }
  .button { width: 100%; margin-top: 0.75rem; padding: 0.9rem 1rem; text-align: center; }
  .button-outline,
  .content a.button-outline { margin-left: 0; }
  .site-footer .container { display: flex; align-items: center; flex-direction: column; }
  .site-footer__links { gap: 1rem; }
  .theme-toggle { min-height: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-toggle__line,
  nav { transition: none; }
}
