/* Wes Masco Design — wesmasco.com */

:root {
  --shell: #f2eee7;
  --ink: #1a1a1a;
  --tidewater: #3e5c5a;
  --muted: #645b4f;
  --rule: rgba(26, 26, 26, 0.22);
  --sans: "Archivo", system-ui, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --gutter: clamp(20px, 5vw, 72px);
  --top: clamp(20px, 2.4vw, 32px);
}

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

html {
  background: var(--shell);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font: 400 1.125rem/1.55 var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html:has(dialog[open]) {
  overflow: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
  font: inherit;
}

ul {
  list-style: none;
  padding: 0;
}

:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  background: var(--shell);
  left: var(--gutter);
  top: var(--top);
  z-index: 20;
  font: 500 0.6875rem/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.skip:not(:focus) {
  clip-path: inset(50%);
}

/* Small uppercase label: menu, project names, section labels */
.label,
.wordmark,
.menu-toggle,
.work-title,
.topbar-title {
  font: 500 0.6875rem/1.4 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ---------- top corners (homepage) and pinned top bar (other pages) ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 1.5rem;
  padding: var(--top) var(--gutter);
  background: var(--shell);
}

.topbar .wordmark {
  justify-self: start;
}

.topbar-title {
  grid-column: 2;
  text-align: center;
}

.topbar .menu-toggle {
  position: static;
  grid-column: 3;
  justify-self: end;
  color: var(--ink);
  mix-blend-mode: normal;
}

@media (max-width: 599px) {
  .topbar {
    grid-template-columns: 1fr auto;
    row-gap: 0.9rem;
  }

  .topbar-title {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .topbar .menu-toggle {
    grid-column: 2;
    grid-row: 1;
  }
}

.menu-toggle {
  position: fixed;
  top: var(--top);
  right: var(--gutter);
  z-index: 10;
  margin: -12px;
  padding: 12px;
  border: 0;
  background: none;
  color: #fff;
  mix-blend-mode: difference; /* stays legible over photography */
  cursor: pointer;
}

/* ---------- menu ---------- */

.menu {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--shell);
  color: var(--ink);
  opacity: 0;
  transition:
    opacity 0.3s ease,
    overlay 0.3s ease allow-discrete,
    display 0.3s ease allow-discrete;
}

.menu[open] {
  display: grid;
  place-items: center;
  opacity: 1;
}

@starting-style {
  .menu[open] {
    opacity: 0;
  }
}

.menu::backdrop {
  background: transparent;
}

.menu .menu-close {
  color: var(--ink);
  mix-blend-mode: normal;
}

.menu ul {
  display: grid;
  gap: 0.6em;
  text-align: center;
  font: 400 clamp(1.625rem, 2.6vw, 2.125rem)/1.2 var(--serif);
}

.menu a:hover {
  color: var(--muted);
}

/* ---------- identity ---------- */

.identity {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--gutter);
}

.identity img {
  width: clamp(180px, 21vw, 300px);
}

/* ---------- work ---------- */
/* Centered like the rest of the homepage: label above, each project's image with its name below. */

.work {
  padding: clamp(120px, 22vh, 240px) var(--gutter) 0;
  text-align: center;
}

.work > .label {
  margin-bottom: 2.25rem;
}

.work-list {
  display: grid;
  gap: clamp(96px, 20vh, 220px);
}

/* Covers sit in a 16:9 frame across the page, cropped from the center, never taller than the screen. */
.work-item {
  position: relative;
  width: min(100%, calc(16 / 9 * 78svh));
  margin-inline: auto;
}

.work-link {
  display: block;
}

.frame {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  touch-action: pan-y; /* vertical scrolling stays native; horizontal swipes cycle images */
}

.frame picture {
  position: absolute;
  inset: 0;
}

.frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Carousel: site.js moves and fades the stacked photos (inline transform/opacity). */
.frame picture {
  backface-visibility: hidden;
}

.slide-nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  aspect-ratio: 16 / 9;
  pointer-events: none;
}

.slide-btn {
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(56px, 11%, 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.slide-btn.prev {
  left: 0;
  background: linear-gradient(to right, rgba(26, 26, 26, 0.24), rgba(26, 26, 26, 0));
}

.slide-btn.next {
  right: 0;
  background: linear-gradient(to left, rgba(26, 26, 26, 0.24), rgba(26, 26, 26, 0));
}

.slide-btn svg {
  opacity: 0.8;
  transition:
    opacity 0.3s ease,
    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-btn:hover svg {
  opacity: 1;
}

.slide-btn.prev:hover svg {
  transform: translateX(-2px);
}

.slide-btn.next:hover svg {
  transform: translateX(2px);
}

.slide-btn:focus-visible {
  opacity: 1;
  outline: 1px solid #fff;
  outline-offset: -6px;
}

@media (hover: hover) {
  .work-item:hover .slide-btn {
    opacity: 1;
  }
}

/* Touch screens have no hover: keep the arrows faintly visible and let swipes do the work. */
@media (hover: none) {
  .slide-btn {
    opacity: 1;
    width: 48px;
  }

  .slide-btn.prev {
    background: linear-gradient(to right, rgba(26, 26, 26, 0.16), rgba(26, 26, 26, 0));
  }

  .slide-btn.next {
    background: linear-gradient(to left, rgba(26, 26, 26, 0.16), rgba(26, 26, 26, 0));
  }

  .slide-btn svg {
    width: 22px;
    height: 22px;
    opacity: 0.75;
  }
}

.work-title {
  margin-top: 1.5rem;
}

.work-location {
  margin-top: 0.15rem;
  color: var(--muted);
}

/* ---------- project page ---------- */

.project {
  padding: clamp(112px, 16vh, 160px) var(--gutter) clamp(96px, 16vh, 180px);
}

.project-meta {
  margin-bottom: clamp(40px, 7vh, 80px);
  text-align: center;
  color: var(--muted);
}

.project-text {
  max-width: 40rem;
  margin: calc(-1 * clamp(24px, 5vh, 56px)) auto clamp(56px, 10vh, 112px);
  text-align: center;
}

.project-text p + p {
  margin-top: 1em;
}

.gallery {
  display: grid;
  justify-items: center;
  gap: clamp(48px, 10vh, 120px);
}

/* Same 16:9 frame as the homepage covers: cropped from the center, never taller than the screen. */
.gallery-item {
  width: min(100%, calc(16 / 9 * 78svh));
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.gallery-item picture {
  display: block;
  height: 100%;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-next {
  margin-top: clamp(96px, 18vh, 200px);
  text-align: center;
}

.project-next a {
  font-size: 1.25rem;
}

.project-next span {
  display: block;
  font: 500 0.6875rem/1.4 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-next a:hover {
  color: var(--muted);
}

/* ---------- homepage sections: projects (coming soon), about, contact ---------- */
/* Centered, label above content, stacked. Desktop runs the services and the form fields across in rows. */

.section {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(120px, 22vh, 240px) var(--gutter) 0;
  text-align: center;
}

.section:last-child {
  padding-bottom: clamp(120px, 20vh, 220px);
}

.section > .label {
  margin-bottom: 2.25rem;
}

.name {
  font-size: 1.5rem;
  line-height: 1.3;
}

.credential {
  color: var(--muted);
}

.statement {
  font-size: 1.25rem;
  line-height: 1.5;
}

.about .statement {
  max-width: 48rem;
  margin: 2.5rem auto 0;
}

.services {
  margin-top: 3.5rem;
}

.services .label {
  color: var(--muted);
}

.services ul {
  margin-top: 1rem;
  font: 400 0.875rem/2 var(--sans);
}

.direct {
  font-size: 1.25rem;
  line-height: 1.6;
}

.direct a:hover,
.statement a:hover {
  color: var(--muted);
}

.contact .form {
  max-width: 34rem;
  margin-inline: auto;
}

@media (min-width: 900px) {
  .services ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem 2.25rem;
    max-width: 52rem;
    margin-inline: auto;
  }

  .contact .form {
    max-width: 52rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: clamp(20px, 2vw, 32px);
  }

  .form .wide,
  .form button,
  .form .form-status {
    grid-column: 1 / -1;
  }
}

/* ---------- form ---------- */

.form {
  display: grid;
  gap: 1.75rem;
  margin-top: 3rem;
}

.form label {
  display: grid;
  text-align: center;
  gap: 0.35rem;
  font: 500 0.6875rem/1.4 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.form input,
.form textarea {
  width: 100%;
  padding: 0.45rem 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  letter-spacing: normal;
  text-transform: none;
  resize: vertical;
}

.form input:focus,
.form textarea:focus {
  outline: none;
  border-bottom-color: var(--ink);
}

.form button {
  justify-self: center;
  margin-top: 0.5rem;
  padding: 0 0 0.3rem;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: none;
  color: var(--ink);
  font: 500 0.6875rem/1.4 var(--sans);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
}

.form button:disabled {
  color: var(--muted);
  border-color: var(--rule);
  cursor: default;
}

.form-status {
  min-height: 1.5em;
  font: 400 0.875rem/1.5 var(--sans);
  color: var(--muted);
}

.form-status a {
  border-bottom: 1px solid var(--rule);
}

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- footer ---------- */

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 2.5rem var(--gutter);
  font: 400 0.6875rem/1.5 var(--sans);
  letter-spacing: 0.04em;
  color: var(--muted);
}

.footer p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 2rem;
}

.footer a:hover {
  color: var(--ink);
}

.footer .footer-links {
  gap: 1.5rem;
}

/* Tidewater icon links: PlotBot, SpotBot, Instagram, LinkedIn, email */
.icon-link {
  display: block;
  color: var(--tidewater);
  transition: opacity 0.3s ease;
}

.icon-link svg {
  display: block;
  width: 24px;
  height: 24px;
}

.footer .icon-link:hover {
  color: var(--tidewater);
  opacity: 0.7;
}

/* ---------- image loading ---------- */

.js img.fade {
  opacity: 0;
  transition: opacity 0.6s ease;
}

.js img.fade.loaded {
  opacity: 1;
}

/* ---------- motion ----------
   Quiet and smooth: opacity and transform only, so nothing shifts the layout.
   Visitors who prefer reduced motion get none of it (see the block below). */

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  /* Landing: the logo settles in, then the menu appears. */
  .identity h1 {
    animation: rise 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
  }

  .home > .menu-toggle {
    animation: appear 1.2s ease 0.9s both;
  }

  /* Scroll: blocks fade up as they enter the screen (site.js adds .in; html.rv is set before first paint). */
  .rv :is(.section > *, .work > .label, .work-item, .project-meta, .gallery-item:not(.vt), .project-next) {
    opacity: 0;
    transform: translateY(18px);
    transition:
      opacity 1s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s),
      transform 1s cubic-bezier(0.22, 1, 0.36, 1) var(--d, 0s);
  }

  .rv :is(.section > *, .work > .label, .work-item, .project-meta, .gallery-item:not(.vt), .project-next).in {
    opacity: 1;
    transform: none;
  }

  /* Hover: project images ease forward slightly inside their frame. */
  .js .frame img {
    transition:
      opacity 0.6s ease,
      transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .work-item:hover .frame img {
    transform: scale(1.02);
  }

  /* Clicking a project: the page cross-fades and the cover glides into the project's first photo. */
  @view-transition {
    navigation: auto;
  }

  ::view-transition-group(*) {
    animation-duration: 0.7s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.45s;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes appear {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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