/* WellsRoad Sites - shared base styles.
   Mobile-first. Every colour, font and size a theme might change is a custom
   property; a site's theme/theme.css overrides the tokens and adds its own touches. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --text: #1b1f24;
  --muted: #5d6673;
  --border: #e2e5ea;
  --accent: #2456c7;
  --accent-ink: #ffffff;
  --link: var(--accent);
  --focus: #2456c7;

  --header-bg: var(--surface);
  --header-text: var(--text);
  --hero-bg: #1b1f24;
  --hero-text: #ffffff;
  --footer-bg: var(--surface-2);
  --footer-text: var(--muted);

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: var(--font-body);
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --heading-weight: 700;
  --heading-tracking: -0.015em;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: clamp(1.4rem, 1.2rem + 1vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.4rem + 1.8vw, 2.5rem);
  --step-4: clamp(2.1rem, 1.5rem + 3vw, 3.5rem);

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --wrap: 1120px;
  --measure: 70ch;
  --gutter: clamp(1rem, 4vw, 2rem);
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh;
}
.site-main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Header / nav ---------- */
.site-header { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.site-header__inner { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; font-family: var(--font-heading); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; margin-right: auto; }
.brand__mark { width: 32px; height: 32px; }
.brand__logo { max-height: 40px; width: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; flex-wrap: wrap; }
.site-nav a { display: block; padding: .5rem .75rem; border-radius: var(--radius-sm); color: inherit; text-decoration: none; font-weight: 500; font-size: .975rem; }
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); }
.nav-toggle { display: none; }

/* With JS, collapse the nav behind a Menu button on small screens. Without JS it simply wraps. */
@media (max-width: 759px) {
  .js .nav-toggle { display: inline-flex; align-items: center; gap: .5rem; background: none; border: 1px solid var(--border); color: inherit; border-radius: var(--radius-sm); padding: .45rem .75rem; font: inherit; font-size: .95rem; cursor: pointer; }
  .nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after { display: block; width: 16px; height: 2px; background: currentColor; position: relative; border-radius: 2px; }
  .nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
  .nav-toggle__bars::before { top: -5px; } .nav-toggle__bars::after { top: 5px; }
  .js .site-nav { display: none; flex-basis: 100%; padding-bottom: .75rem; }
  .js .site-nav.is-open { display: block; }
  .js .site-nav ul { flex-direction: column; }
  .js .site-nav a { padding: .75rem .5rem; font-size: 1.05rem; border-bottom: 1px solid var(--border); border-radius: 0; }
}

/* ---------- Hero ---------- */
.hero { position: relative; background: var(--hero-bg); color: var(--hero-text); overflow: hidden; isolation: isolate; }
.hero__bg { position: absolute; inset: 0; z-index: -1; }
.hero__bg img { width: 100%; height: 100%; object-fit: cover; }
.hero--image::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55)); }
.hero__inner { padding-block: clamp(3rem, 10vw, 7rem); }
.hero__heading { font-size: var(--step-4); max-width: 18ch; margin-bottom: .35em; }
.hero__text { font-size: var(--step-1); max-width: 46ch; opacity: .9; margin: 0; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(2.5rem, 6vw, 4rem); }
.section + .section { padding-top: 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.section__head h2 { margin: 0; }
.section__head a { font-weight: 600; text-decoration: none; white-space: nowrap; }
.page-head { padding-block: clamp(2rem, 5vw, 3rem) 1.5rem; }
.page-head h1 { margin: 0; }
.page-head__sub { color: var(--muted); margin: .5rem 0 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 600; color: var(--muted); margin: 0 0 .4rem; }
.eyebrow a { color: inherit; }
.subhead { font-size: var(--step-1); margin: 2rem 0 1rem; }
.empty { color: var(--muted); }
.meta { color: var(--muted); font-size: var(--step--1); margin: 0 0 .35rem; }
.meta a { color: inherit; }

/* ---------- Buttons / tags ---------- */
.button { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem 1rem; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: .95rem; text-decoration: none; border: 1px solid var(--accent); }
.button:hover { filter: brightness(1.08); }
.button--ghost { background: transparent; color: var(--accent); }
.link-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.25rem 0; }
.tags { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { display: inline-block; font-size: .8rem; line-height: 1; padding: .4rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); text-decoration: none; border: 1px solid var(--border); }
.tag:hover { color: var(--accent); border-color: currentColor; }
.status { font-weight: 600; }

/* ---------- Post list ---------- */
.post-list { display: grid; gap: 1.25rem; }
.post-card { display: grid; gap: 1rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.post-card:last-child { border-bottom: 0; }
.post-card__media img { border-radius: var(--radius-sm); aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.post-card__title { font-size: var(--step-1); margin: 0 0 .35rem; }
.post-card__title a { color: inherit; text-decoration: none; }
.post-card__title a:hover { color: var(--accent); }
.post-card__excerpt { color: var(--muted); margin: 0; }
@media (min-width: 640px) {
  .post-card--image { grid-template-columns: 220px 1fr; align-items: start; }
}

/* ---------- Projects ---------- */
.project-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); padding-bottom: 3rem; }
.project-grid--compact { padding-bottom: 0; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.project-card__media { display: block; aspect-ratio: 16 / 10; background: var(--surface-2); }
.project-card__media img { width: 100%; height: 100%; object-fit: cover; }
.project-card__placeholder { display: grid; place-items: center; height: 100%; font-family: var(--font-heading); font-size: 3rem; font-weight: 700; color: var(--muted); }
.project-card__body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.project-card__title { font-size: var(--step-1); margin: 0 0 .35rem; }
.project-card__title a { color: inherit; text-decoration: none; }
.project-card__title a::after { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.project-card { position: relative; }
.project-card .tags { position: relative; z-index: 1; margin-top: auto; padding-top: .75rem; }
.project-card__summary { color: var(--muted); margin: 0; font-size: .975rem; }

/* ---------- Layout with sidebar ---------- */
.layout-sidebar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; padding-bottom: 3rem; }
@media (min-width: 960px) {
  .layout-sidebar { grid-template-columns: minmax(0, 1fr) 280px; gap: 4rem; }
  .sidebar { padding-top: clamp(2rem, 5vw, 3rem); }
}
.sidebar__section { margin-bottom: 2rem; }
.sidebar__title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .75rem; }
.sidebar__list { list-style: none; margin: 0; padding: 0; }
.sidebar__list li { padding: .6rem 0; border-bottom: 1px solid var(--border); line-height: 1.35; }
.sidebar__list a { color: inherit; text-decoration: none; font-weight: 500; display: block; }
.sidebar__list a:hover { color: var(--accent); }
.sidebar__list time { color: var(--muted); font-size: .8rem; }

/* ---------- Entries (post, project, page) ---------- */
.entry { padding-bottom: 3rem; }
.entry__head { padding-block: clamp(2rem, 5vw, 3rem) 1.5rem; max-width: var(--measure); }
.entry__title { font-size: var(--step-3); margin-bottom: .4em; }
.entry__lede { font-size: var(--step-1); color: var(--muted); margin: 0; }
.entry__feature { margin: 0 0 2rem; }
.entry__feature img { border-radius: var(--radius); width: 100%; }
.entry__feature figcaption { color: var(--muted); font-size: var(--step--1); margin-top: .5rem; }
.entry--project .prose, .entry--page .prose { max-width: var(--measure); }
.entry__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.entry__nav a { text-decoration: none; color: inherit; font-weight: 600; line-height: 1.35; }
.entry__nav a span { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: .25rem; }
.entry__nav-next { text-align: right; grid-column: 2; }

/* ---------- Prose (rendered Markdown) ---------- */
.prose { max-width: var(--measure); overflow-wrap: break-word; }
.prose > * + * { margin-top: 1.1em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table, .prose figure { margin-bottom: 0; }
.prose h2 { margin-top: 2em; } .prose h3 { margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose img { border-radius: var(--radius-sm); margin-inline: auto; }
.prose blockquote { margin-inline: 0; padding: .25em 0 .25em 1.25em; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); padding: .12em .35em; border-radius: 4px; border: 1px solid var(--border); }
.prose pre { background: #0f1720; color: #e6edf3; padding: 1rem 1.1rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: .875rem; line-height: 1.55; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin-block: 2.5em; }
.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.prose th { font-weight: 600; }

/* ---------- Gallery ---------- */
.album-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); padding-bottom: 3rem; }
.album-card { text-decoration: none; color: inherit; display: block; }
.album-card__media { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; margin-bottom: .6rem; }
.album-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.album-card:hover img { transform: scale(1.03); }
.album-card__title { display: block; font-weight: 600; font-family: var(--font-heading); }
.photo-grid { display: grid; gap: .5rem; grid-template-columns: repeat(2, 1fr); padding-bottom: 3rem; }
@media (min-width: 640px) { .photo-grid { grid-template-columns: repeat(3, 1fr); gap: .75rem; } }
@media (min-width: 1000px) { .page-album .photo-grid { grid-template-columns: repeat(4, 1fr); } }
.photo-grid figure { margin: 0; }
.photo-grid img { aspect-ratio: 1; object-fit: cover; width: 100%; border-radius: var(--radius-sm); }
.photo-grid figcaption { font-size: .8rem; color: var(--muted); margin-top: .3rem; line-height: 1.35; }

.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(8, 10, 14, .92); }
.lightbox__inner { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3.5rem 1rem 1rem; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 7rem); object-fit: contain; border-radius: 4px; }
.lightbox__caption { color: #d7dbe0; margin-top: .75rem; text-align: center; font-size: .95rem; min-height: 1.5em; }
.lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; border-radius: 999px; width: 44px; height: 44px; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.lightbox button:hover { background: rgba(255,255,255,.25); }
.lightbox__close { top: .75rem; right: .75rem; }
.lightbox__prev { left: .75rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: .75rem; top: 50%; transform: translateY(-50%); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 2rem; }
.pagination__status { color: var(--muted); font-size: var(--step--1); }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); border-top: 1px solid var(--border); font-size: .925rem; }
.site-footer__inner { display: grid; gap: 1rem 2rem; padding-block: 2rem; }
@media (min-width: 760px) { .site-footer__inner { grid-template-columns: 1fr auto; align-items: start; } .site-footer__copy { grid-column: 1 / -1; } }
.site-footer__title { font-weight: 700; color: var(--text); margin: 0 0 .25rem; font-family: var(--font-heading); }
.site-footer__about p:last-child { margin-bottom: 0; }
.site-footer__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
.site-footer__links a { color: inherit; }
.site-footer__copy { margin: 0; font-size: .85rem; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------- Contact form ---------- */
.contact { margin-top: 1.5em; }
.contact__form { display: grid; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1rem, 4vw, 1.75rem); }
.contact__row { display: grid; gap: 1rem; }
@media (min-width: 640px) { .contact__row { grid-template-columns: 1fr 1fr; } }
.contact__field { display: grid; gap: .35rem; font-weight: 600; font-size: .95rem; }
.contact__field input, .contact__field textarea {
  width: 100%; font: inherit; font-weight: 400; font-size: 16px; /* no iOS zoom */
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .7rem .8rem; min-height: 46px;
}
.contact__field textarea { resize: vertical; line-height: 1.55; }
.contact__field input:focus, .contact__field textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.contact__form .button { justify-self: start; min-height: 46px; padding-inline: 1.4rem; cursor: pointer; font: inherit; font-weight: 600; }
.contact__privacy { margin: 0; color: var(--muted); font-size: var(--step--1); }
.contact__notice { margin: 0; padding: .85rem 1rem; border-radius: var(--radius-sm); border: 1px solid; }
.contact__notice--ok { color: var(--text); border-color: var(--accent); background: var(--surface); }
.contact__notice--error { color: #b42318; border-color: currentColor; background: var(--surface); }
.contact__hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
