/* ==========================================================================
   brianrace.com
   Colors and type live in the :root block below. Change them once here and
   the whole site follows.
   ========================================================================== */

:root {
  --paper: #f3f5f4;      /* page background: glacier mist */
  --paper-2: #e6ecea;    /* raised panels */
  --ink: #172026;        /* main text: slate */
  --ink-2: #4b5860;      /* secondary text */
  --line: #cdd6d3;       /* rules and borders */
  --fjord: #1d5a66;      /* links and buttons */
  --fjord-hover: #134551;
  --on-fjord: #ffffff;
  --dusk: #c58a26;       /* small highlight: current page, quote rule */

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, system-ui, sans-serif;

  --wrap: 72rem;
  --wrap-wide: 80rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius: 4px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11171a;
    --paper-2: #192226;
    --ink: #e3e9e7;
    --ink-2: #9eacb1;
    --line: #2b383d;
    --fjord: #8cc4cd;
    --fjord-hover: #b3dbe1;
    --on-fjord: #0d1a1d;
    --dusk: #e1b05a;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.1; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 5.6vw, 4.5rem); letter-spacing: -0.02em; font-variation-settings: "opsz" 72; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.25rem); letter-spacing: -0.01em; }
h3 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
a { color: var(--fjord); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--fjord-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--fjord); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.wrap-wide { width: min(100% - 2 * var(--gutter), var(--wrap-wide)); margin-inline: auto; }
.section { margin-block: clamp(4rem, 9vw, 7rem); }

.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--paper); padding: .6rem 1rem; z-index: 50; border-radius: var(--radius); }
.skip:focus { top: 1rem; }

.prose { font-family: var(--serif); font-size: 1.2rem; line-height: 1.68; max-width: 38em; }
.prose p { margin-bottom: 1.1em; }
.prose .aside { font-style: italic; color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font: 500 .98rem/1 var(--sans);
  padding: .85em 1.3em; border-radius: 999px;
  background: var(--fjord); color: var(--on-fjord); text-decoration: none;
  border: 1px solid var(--fjord);
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--fjord-hover); border-color: var(--fjord-hover); color: var(--on-fjord); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: transparent; color: var(--fjord); border-color: var(--fjord); }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem; }
.wordmark { font: 500 1.45rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.wordmark:hover { color: var(--ink); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: clamp(1rem, 3vw, 2.25rem); }
.site-nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .98rem; padding-block: .4rem; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--dusk); }
.menu-toggle { display: none; }

@media (max-width: 44rem) {
  .menu-toggle {
    display: inline-flex; align-items: center; gap: .55rem;
    background: none; border: 1px solid var(--line); border-radius: 999px;
    color: var(--ink); font: 500 .95rem/1 var(--sans); padding: .55rem .9rem; cursor: pointer;
  }
  .menu-toggle__bars, .menu-toggle__bars::before { display: block; width: 14px; height: 1.5px; background: currentColor; position: relative; transition: transform .2s; }
  .menu-toggle__bars::before { content: ""; position: absolute; top: 5px; }
  .menu-toggle__bars { transform: translateY(-2.5px); }
  .menu-toggle[aria-expanded="true"] .menu-toggle__bars { transform: rotate(45deg); }
  .menu-toggle[aria-expanded="true"] .menu-toggle__bars::before { transform: translateY(-5px) rotate(-90deg); }
  .site-header { position: relative; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--line); z-index: 20; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; width: min(100% - 2 * var(--gutter), var(--wrap)); margin: 0 auto; padding-block: .5rem 1rem; }
  .site-nav a { display: block; padding: .8rem 0; font-size: 1.15rem; border-bottom: 1px solid var(--line); }
  .site-nav li:last-child a { border-bottom: 0; }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--line); box-shadow: inset 3px 0 0 var(--dusk); padding-left: .8rem; }
  .no-js .site-nav { display: block; position: static; }
}

/* ---------- home ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 2rem clamp(2rem, 5vw, 4.5rem); align-items: end; padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 4vw, 3rem); }
.intro__title { font-size: clamp(2.5rem, 5.4vw, 4.6rem); line-height: 1.02; }
.intro__body { color: var(--ink-2); font-size: 1.08rem; }
.intro__actions, .page-head__actions, .hire-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 0; }
@media (max-width: 52rem) { .intro { grid-template-columns: 1fr; align-items: start; } }

/* The one moving thing on the site: a slow cross-fade through panoramas */
.pano { margin-block: 0; position: relative; }
.pano__frame { position: relative; aspect-ratio: 960 / 250; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); }
.pano__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.6s ease; }
.pano__img.is-active { opacity: 1; }
.pano__pause {
  position: absolute; right: .75rem; bottom: .75rem;
  font: 500 .8rem/1 var(--sans); color: #fff; background: rgba(10, 16, 18, .55);
  border: 0; border-radius: 999px; padding: .5rem .8rem; cursor: pointer; backdrop-filter: blur(6px);
}
.pano__pause:hover { background: rgba(10, 16, 18, .75); }
@media (max-width: 40rem) { .pano__frame { aspect-ratio: 16 / 7; } }
@media (prefers-reduced-motion: reduce) { .pano__img { transition: none; } }

.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem 3rem; align-items: end; margin-bottom: 2.25rem; }
.section-head p { color: var(--ink-2); margin: 0; max-width: 34em; }
@media (max-width: 52rem) { .section-head { grid-template-columns: 1fr; } }

.trip-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 2.5rem clamp(1rem, 2.5vw, 2rem); }
.trip-card a { display: grid; gap: .35rem; color: inherit; text-decoration: none; }
.trip-card__img { display: block; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); margin-bottom: .6rem; }
.trip-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.trip-card a:hover .trip-card__img img { transform: scale(1.03); }
.trip-card__title { font: 400 1.6rem/1.15 var(--serif); }
.trip-card a:hover .trip-card__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .15em; }
.trip-card__meta { color: var(--ink-2); font-size: .95rem; display: flex; justify-content: space-between; gap: 1rem; }
.trip-card__count { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .trip-card__img img { transition: none; } }

.notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 2rem clamp(1.5rem, 3vw, 3rem); }
.note { border-top: 1px solid var(--ink); padding-top: 1.25rem; }
.note h2 { font-size: 1.6rem; margin-bottom: .75rem; }
.note p { color: var(--ink-2); }
.note p:last-child { margin-bottom: 0; }

/* ---------- inner pages ---------- */
.page-head { padding-block: clamp(3rem, 7vw, 5rem) clamp(2rem, 4vw, 3rem); }
.page-head h1 { max-width: 16ch; }
.lede { font: 400 clamp(1.2rem, 1.9vw, 1.45rem)/1.5 var(--serif); color: var(--ink-2); max-width: 36em; margin-top: 1.25rem; }
.lede a { color: var(--fjord); }

/* work */
.work-list { margin-bottom: clamp(4rem, 8vw, 6rem); }
.work-item { display: grid; grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr); gap: 1rem clamp(2rem, 5vw, 4rem); border-top: 1px solid var(--line); padding-block: 2.5rem; }
.work-item > h2 { font-size: 1.75rem; }
.work-item__body { max-width: 42rem; }
.work-item__body h3 { margin: 0 0 .6rem; }
.work-item__body h3:not(:first-child) { margin-top: 2.25rem; }
.work-item__body p { color: var(--ink-2); }
.links { margin: 0; font-weight: 500; }
.pieces { margin: 1.5rem 0 0; display: grid; gap: 0; }
.pieces > div { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.pieces dt { font-weight: 500; }
.pieces dd { margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.ticks { padding: 0; margin: 0 0 1.25rem; list-style: none; color: var(--ink-2); }
.ticks li { padding-left: 1.4rem; position: relative; margin-bottom: .55rem; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .72em; width: .55rem; height: 1px; background: var(--ink-2); }
@media (max-width: 44rem) {
  .work-item { grid-template-columns: 1fr; }
  .pieces > div { grid-template-columns: 1fr; gap: .25rem; }
}

/* photographs */
.philosophy { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 3rem clamp(2rem, 6vw, 5rem); padding-bottom: clamp(3rem, 7vw, 5rem); border-bottom: 1px solid var(--line); }
.quotes { display: grid; gap: 1.75rem; align-content: start; }
.quote { margin: 0; padding-left: 1.25rem; border-left: 2px solid var(--line); }
.quote p { font: italic 400 1.12rem/1.5 var(--serif); margin-bottom: .4rem; }
.quote footer { font-size: .9rem; color: var(--ink-2); }
.quote--lead { border-left-color: var(--dusk); }
.quote--lead p { font-size: 1.35rem; line-height: 1.45; }
@media (max-width: 56rem) { .philosophy { grid-template-columns: 1fr; } }

.trip-stories { margin-bottom: clamp(4rem, 8vw, 6rem); }
.trip-story { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2rem clamp(2rem, 5vw, 4.5rem); align-items: start; padding-block: clamp(3rem, 7vw, 5rem); border-bottom: 1px solid var(--line); }
.trip-story:nth-child(even) .trip-story__img { order: 2; }
.trip-story__img { position: sticky; top: 2rem; display: block; aspect-ratio: 3 / 2; overflow: hidden; border-radius: var(--radius); background: var(--paper-2); }
.trip-story__img img { width: 100%; height: 100%; object-fit: cover; }
.trip-story h2 { font-size: clamp(2rem, 3.6vw, 2.9rem); }
.trip-story h2 a { color: inherit; text-decoration: none; }
.trip-story h2 a:hover { text-decoration: underline; text-decoration-thickness: 1px; }
.trip-story__when { color: var(--ink-2); margin-bottom: .5rem; font-size: .95rem; }
.trip-story__route { color: var(--ink-2); margin: .75rem 0 1.5rem; }
.trip-story .prose { font-size: 1.12rem; }
@media (max-width: 52rem) {
  .trip-story { grid-template-columns: 1fr; }
  .trip-story:nth-child(even) .trip-story__img { order: 0; }
  .trip-story__img { position: static; }
}

/* trip page */
.trip-head { padding-block: clamp(2.5rem, 6vw, 4.5rem) 1.25rem; }
.crumbs { margin-bottom: 1rem; font-size: .95rem; }
.crumbs a::before { content: "‹"; margin-right: .4em; }
.trip-head__meta { margin: 1rem 0 .25rem; font-size: 1.05rem; }
.trip-head__route { color: var(--ink-2); margin: 0; }
.trip-intro { margin-bottom: 2rem; }
.story-toggle { border-block: 1px solid var(--line); }
.story-toggle > summary { cursor: pointer; padding: 1rem 0; font-weight: 500; list-style: none; display: flex; justify-content: space-between; }
.story-toggle > summary::-webkit-details-marker { display: none; }
.story-toggle > summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--ink-2); }
.story-toggle[open] > summary::after { content: "–"; }
.story-toggle .prose { padding-bottom: 1rem; }

.gallery { margin-bottom: 3rem; }
.gallery-grid { display: flex; flex-wrap: wrap; gap: 6px; padding-inline: clamp(6px, 1.5vw, 1.5rem); }
.gallery-grid::after { content: ""; flex-grow: 1000000; }
.g-item { margin: 0; flex: calc(var(--r) * 100) 1 calc(var(--r) * 13rem); max-width: 100%; }
.g-item a { display: block; height: 100%; background: var(--paper-2); }
.g-item img { width: 100%; height: 100%; aspect-ratio: var(--r); object-fit: cover; }
.g-item a:hover img { opacity: .88; }
@media (max-width: 40rem) { .g-item { flex-basis: calc(var(--r) * 5.5rem); } .gallery-grid { gap: 4px; } }
.gallery-hint { color: var(--ink-2); font-size: .92rem; margin-top: 1.25rem; }
.no-lightbox .gallery-hint { display: none; }

.trip-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: clamp(3rem, 7vw, 5rem); }
.trip-pager__link { display: grid; gap: .3rem; padding: 1.25rem 0; border-top: 1px solid var(--ink); text-decoration: none; color: var(--ink); font: 400 1.5rem/1.2 var(--serif); }
.trip-pager__link span { font: 500 .9rem/1 var(--sans); color: var(--ink-2); }
.trip-pager__link--next { grid-column: 2; text-align: right; }
.trip-pager__link:hover { color: var(--fjord); }

/* lightbox */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: #0b1012; color: #e9eeec;
}
.lightbox::backdrop { background: #0b1012; }
.lightbox[open] { display: grid; grid-template-rows: 1fr auto; }
.lightbox__stage { display: grid; place-items: center; min-height: 0; padding: clamp(.5rem, 3vw, 2.5rem) clamp(.5rem, 6vw, 5.5rem) 0; }
.lightbox__img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; box-shadow: 0 20px 60px rgba(0,0,0,.45); transition: opacity .2s; }
.lightbox__img.is-loading { opacity: .25; }
.lightbox__bar { margin: 0; display: flex; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 6vw, 5.5rem) 1.25rem; font-size: .95rem; color: #b8c4c6; }
.lightbox__caption { font: italic 400 1.1rem/1.3 var(--serif); color: #e9eeec; }
.lightbox__btn {
  position: absolute; width: 3rem; height: 3rem; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center;
}
.lightbox__btn:hover { background: rgba(255,255,255,.18); }
.lightbox__btn svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lightbox :focus-visible { outline-color: #fff; }
@media (max-width: 40rem) {
  .lightbox__prev, .lightbox__next { top: auto; bottom: .6rem; transform: none; }
  .lightbox__prev { left: auto; right: 4.5rem; }
  .lightbox__next { right: 1rem; }
  .lightbox__bar { padding-right: 9rem; flex-direction: column; gap: .2rem; }
}

/* about */
.about-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem); gap: 3rem clamp(2rem, 6vw, 5rem); align-items: start; margin-bottom: clamp(4rem, 8vw, 6rem); }
.chapter { border-top: 1px solid var(--line); padding-block: 2.5rem; }
.chapter h2 { margin-bottom: 1.1rem; }
.chapter p { font-family: var(--serif); font-size: 1.2rem; line-height: 1.7; max-width: 38em; }
.chapter__lead { margin-bottom: 0; }
.chapter__more > summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .5rem;
  margin-top: 1.25rem; font-weight: 500; color: var(--fjord);
}
.chapter__more > summary::-webkit-details-marker { display: none; }
.chapter__more > summary::after { content: ""; width: .45rem; height: .45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s; }
.chapter__more[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.chapter__more[open] > summary { order: 2; }
.chapter__more[open] { display: flex; flex-direction: column; }
.chapter__more[open] > p:first-of-type { margin-top: 1.1em; }
.chapter__more .when-open, .chapter__more[open] .when-closed { display: none; }
.chapter__more[open] .when-open { display: inline; }
.more-to-come { font: italic 1.2rem var(--serif); color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 2rem; }
.favorites { position: sticky; top: 2rem; background: var(--paper-2); border-radius: var(--radius); padding: 1.75rem; margin-top: 2.5rem; }
.favorites h2 { font-size: 1.45rem; margin-bottom: 1.25rem; }
.favorites dl { margin: 0; }
.favorites dt { font-weight: 600; margin-top: 1rem; }
.favorites dt:first-child { margin-top: 0; }
.favorites dd { margin: .2rem 0 0; color: var(--ink-2); font-size: .98rem; }
@media (max-width: 56rem) {
  .about-layout { grid-template-columns: 1fr; }
  .favorites { position: static; order: -1; margin-top: 0; }
}

/* contact */
.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-bottom: clamp(4rem, 8vw, 6rem); }
.contact-card { display: grid; gap: .5rem; padding: 1.75rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color .15s; }
.contact-card:hover { border-color: var(--fjord); color: var(--ink); }
.contact-card__label { color: var(--ink-2); font-size: .95rem; }
.contact-card__value { font: 400 1.45rem/1.2 var(--serif); overflow-wrap: anywhere; }
.contact-card:hover .contact-card__value { color: var(--fjord); }

.lost-links { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; font-weight: 500; }

/* ---------- footer ---------- */
.site-footer { background: var(--paper-2); padding-block: clamp(3rem, 7vw, 5rem) 2rem; margin-top: 0; }
.hire { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1rem 3rem; align-items: start; padding-bottom: clamp(2.5rem, 6vw, 4rem); border-bottom: 1px solid var(--line); }
.hire h2 { font-size: clamp(2rem, 4vw, 3rem); }
.hire p { color: var(--ink-2); max-width: 32em; margin: 0; }
.hire .hire-actions { grid-column: 2; margin-top: .25rem; }
@media (max-width: 48rem) { .hire { grid-template-columns: 1fr; } .hire .hire-actions { grid-column: 1; } }
.footer-base { display: grid; grid-template-columns: auto 1fr; gap: 1rem 2rem; align-items: baseline; padding-top: 2rem; }
.footer-name { font: 500 1.25rem/1 var(--serif); margin: 0; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem 1.5rem; }
.footer-links a { color: var(--ink-2); text-decoration: none; font-size: .95rem; }
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--ink); }
.footer-legal { grid-column: 1 / -1; color: var(--ink-2); font-size: .88rem; margin: 1rem 0 0; }
@media (max-width: 40rem) { .footer-base { grid-template-columns: 1fr; } .footer-links { justify-content: flex-start; } }

/* trip page hides the hire box to keep the focus on photos */
.page-trip .hire { display: none; }
.page-trip .footer-base { padding-top: 0; }

@media print {
  .site-header nav, .menu-toggle, .pano, .site-footer .hire-actions, .lightbox { display: none !important; }
  body { background: #fff; color: #000; }
}
