:root {
  --ink: #111;
  --muted: #666;
  --line: #ddd;
  --accent: #c83b25;
  --green: #446236;
  --pad: max(4.3%, env(safe-area-inset-left));
  --header-h: 64px;   /* header bar height */
  --logo-size: 100px; /* logo circle; anything above --header-h overhangs */
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

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

body {
  overflow: hidden;
  overscroll-behavior: none;
  background: #fff;
  color: var(--ink);
  font-family: "Jost", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.site {
  position: relative;
  display: grid;
  grid-template-rows: calc(var(--header-h) + env(safe-area-inset-top, 0px)) minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
}

/* Header: title left, logo centred, socials and menu right */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: env(safe-area-inset-top, 0px)
    max(4.3%, env(safe-area-inset-right)) 0 var(--pad);
  background: #fff;
  border-bottom: 1px solid #eee;
  position: relative;
  z-index: 10;
}

.header-title {
  justify-self: start;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  background: none;
  border: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.logo {
  display: block;
  align-self: start;
  width: var(--logo-size);
  height: var(--logo-size);
  /* Cancels the overhang so the logo takes exactly the header's height in the
     grid row; title and menu then stay centred in the header bar. */
  margin-bottom: calc(var(--header-h) - var(--logo-size));
  padding: 5px;
  box-sizing: border-box;
  border: 1px solid #eee;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0);
}

.header-right {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: clamp(16px, 2.4vw, 30px);
}

.social {
  display: flex;
  align-items: center;
  gap: 14px;
}

.social a {
  display: flex;
  color: var(--ink);
  transition: opacity 0.2s;
}

.social svg {
  width: 19px;
  height: 19px;
}

nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 38px);
}

.nav-tab {
  position: relative;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-tab::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--ink);
  content: "";
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.nav-tab.is-active::after {
  transform: scaleX(1);
}

.nav-pill {
  padding: 7px 20px;
  border: 1px solid var(--ink);
  border-radius: 999px;
}

.nav-pill::after {
  display: none;
}

.nav-pill.is-active {
  background: var(--ink);
  color: #fff;
}

/* Main content */
main {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #fff;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
}

.view.on {
  display: block;
}

/* Work slideshow */
.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.hero-photo.visible {
  opacity: 1;
}

#work .caption {
  position: absolute;
  right: auto;
  bottom: 96px;
  left: var(--pad);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 22px;
  width: fit-content;
  max-width: calc(100% - 2 * var(--pad));
  padding: 16px 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(2px);
  color: #fff;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.35);
}

.caption > div:last-child {
  min-width: 0;
}

.count {
  position: relative;
  flex: none;
  width: 68px;
  height: 68px;
  border: 1px solid #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.06em;
}

.count span {
  position: absolute;
}

.count .a {
  top: 14px;
  left: 15px;
}

.count .b {
  right: 15px;
  bottom: 14px;
}

.count::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 1px;
  background: #fff;
  content: "";
  transform: translate(-50%, -50%) rotate(-55deg);
}

.tagline {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.9;
}

.ptitle {
  margin: 0;
  font-size: clamp(20px, 2.3vw, 28px);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.25;
}

.vlink {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-shadow: inherit;
}

.vlink::after {
  width: 34px;
  height: 1px;
  background: #fff;
  content: "";
  transition: width 0.3s ease;
}

.dots {
  position: absolute;
  bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  z-index: 2;
  display: flex;
  transform: translateX(-50%);
}

.dots button {
  position: relative;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: none;
}

.dots button::after {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  border: 1px solid #fff;
  border-radius: 50%;
  content: "";
  opacity: 0.8;
}

.dots button.selected::after {
  background: #fff;
  opacity: 1;
}

/* About and contact */
.information-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
  background: #fff;
}

.information-copy {
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 620px;
  max-height: 100%;
  overflow-y: auto;
  padding: 24px 10% 90px;
}

.information-copy h1 {
  margin: 0 0 24px;
  font-size: clamp(34px, 4vw, 58px);
  font-weight: 300;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-transform: uppercase;
}

.body {
  max-width: 470px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 18px;
  font-weight: 300;
  line-height: 1.6;
}

.services {
  max-width: 470px;
  margin: 0 0 28px;
}

.services div {
  display: flex;
  gap: 25px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
  font-size: 15px;
}

.services span {
  align-self: center;
  color: var(--green);
  font-size: 11px;
  letter-spacing: 0.1em;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  padding: 0 0 9px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: none;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.email {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 470px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: clamp(16px, 1.7vw, 24px);
  font-weight: 300;
  letter-spacing: 0.02em;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.information-photo {
  overflow: hidden;
  background: #e7e4da;
}

.information-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Footer: black, fading into the page */
.site-footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 120px;
  padding: 0 max(4.3%, env(safe-area-inset-right))
    calc(14px + env(safe-area-inset-bottom, 0px)) var(--pad);
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.40) 45%,
    rgba(0, 0, 0, 0.0) 100%
  );
  color: #fff;
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
}

.materials {
  display: flex;
  align-items: center;
  gap: 14px;
}

.materials i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
}

/* Hover effects */
@media (hover: hover) {
  .nav-tab:hover::after {
    transform: scaleX(1);
  }

  .nav-pill:hover {
    background: var(--ink);
    color: #fff;
  }

  .social a:hover {
    opacity: 0.55;
  }

  .vlink:hover::after {
    width: 52px;
  }

  .email:hover {
    color: var(--accent);
  }
}

/* Medium screens */
@media (max-width: 1100px) {
  .header-title {
    font-size: 14px;
    letter-spacing: 0.14em;
  }
}

@media (max-width: 900px) {
  nav {
    gap: 16px;
  }

  .nav-tab {
    font-size: 11px;
  }
}

/* Phones and small tablets */
@media (max-width: 767px) {
  :root {
    --header-h: 60px;
    --logo-size: 72px;
  }

  .site-header {
    grid-template-columns: auto 1fr;
  }

  .header-title {
    display: none;
  }

  .logo {
    justify-self: start;
    padding: 12px;
  }

  .social {
    gap: 6px;
  }

  .social a {
    padding: 10px;
  }

  nav {
    gap: 14px;
  }

  .nav-tab {
    min-height: 44px;
    padding: 0;
  }

  .nav-pill {
    min-height: 0;
    padding: 7px 14px;
  }

  .caption {
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    gap: 14px;
  }

  .count {
    width: 56px;
    height: 56px;
    font-size: 11px;
  }

  .count .a {
    top: 11px;
    left: 12px;
  }

  .count .b {
    right: 12px;
    bottom: 11px;
  }

  .count::after {
    width: 20px;
  }

  .materials {
    display: none;
  }

  .site-footer {
    height: 100px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    font-size: 10px;
  }

  .dots {
    bottom: calc(44px + env(safe-area-inset-bottom, 0px));
  }

  .information-view {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 50%;
  }

  .information-copy {
    align-self: start;
    max-width: none;
    padding: 18px 7% 8px;
  }

  .information-copy h1 {
    margin-bottom: 10px;
    font-size: clamp(26px, 7vw, 34px);
  }

  .body {
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.5;
  }

  .services {
    margin-bottom: 12px;
  }

  .services div {
    padding: 6px 0;
    font-size: 13px;
  }

  .text-link {
    padding-bottom: 6px;
  }
}

/* Touchscreen dot controls */
@media (pointer: coarse) {
  .dots button {
    width: 28px;
    height: 28px;
  }

  .dots button::after {
    top: 10px;
    left: 10px;
  }
}

/* Small phones */
@media (max-width: 560px) {
  .social {
    display: none;
  }
}

@media (max-width: 380px) {
  nav {
    gap: 10px;
  }

  .nav-tab {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .nav-pill {
    padding: 6px 11px;
  }
}

/* Landscape phones */
@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --header-h: 50px;
    --logo-size: 60px;
  }

  .logo {
    padding: 10px;
  }

  .tagline,
  .count {
    display: none;
  }

  .caption {
    bottom: 62px;
  }

  .ptitle {
    font-size: 20px;
  }

  .dots {
    bottom: 30px;
  }

  .site-footer {
    height: 64px;
    padding-bottom: 8px;
  }

  .information-view {
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: none;
  }

  .information-copy {
    align-self: start;
    padding: 14px 6% 56px;
  }

  .information-copy h1 {
    margin-bottom: 10px;
    font-size: 24px;
  }

  .body {
    margin-bottom: 10px;
    font-size: 13px;
  }

  .services {
    margin-bottom: 10px;
  }

  .services div {
    padding: 5px 0;
    font-size: 12px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero-photo,
  .nav-tab::after,
  .vlink::after {
    transition: none;
  }
}

/* Slideshow arrows */
.slide-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
  transform: translateY(-50%);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.slide-arrow--previous {
  left: var(--pad);
}

.slide-arrow--next {
  right: var(--pad);
}

.slide-arrow:hover {
  border-color: #fff;
  background: rgba(0, 0, 0, 0.45);
}

@media (max-width: 767px) {
  .slide-arrow {
    width: 38px;
    height: 38px;
    font-size: 28px;
  }
}

/* ==========================================================
   Mobile optimisation (portrait phones)
   Page stays fixed (no page scroll); only About/Contact copy
   scrolls inside its own area if it doesn't fit.
   ========================================================== */
@media (max-width: 767px) and (orientation: portrait) {
  /* About / Contact: photo on top, copy below, view scrolls itself */
  #about,
  #contact {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .information-view {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100%;
  }

  .information-photo {
    order: -1;
    flex: none;
    height: 32dvh;
    min-height: 180px;
  }

  .information-copy {
    flex: 1 0 auto;
    align-self: stretch;
    max-height: none;
    overflow: visible;
    padding: 22px 6% calc(32px + env(safe-area-inset-bottom, 0px));
  }

  .information-copy h1 {
    margin-bottom: 14px;
    font-size: clamp(28px, 8vw, 36px);
  }

  .body {
    max-width: none;
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
  }

  .services {
    max-width: none;
    margin-bottom: 22px;
  }

  .services div {
    padding: 11px 0;
    font-size: 15px;
  }

  .text-link {
    min-height: 44px;
    padding-bottom: 8px;
  }

  .email {
    max-width: none;
    min-height: 56px;
    font-size: 17px;
  }

  /* Footer would sit on top of the copy, so only show it over the slideshow */
  body:not([data-view="work"]) .site-footer {
    display: none;
  }

  /* Slideshow caption: fit narrow screens */
  #work .caption {
    padding: 12px 14px;
    gap: 12px;
    max-width: calc(100% - 2 * var(--pad));
  }

  .ptitle {
    font-size: 18px;
    letter-spacing: 0.05em;
  }

  .tagline {
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .vlink {
    min-height: 40px;
  }
}

/* Touch devices: swipe + dots already navigate, so drop the arrows */
@media (pointer: coarse) {
  .slide-arrow {
    display: none;
  }
}

/* Keep taps from highlighting text in the slideshow */
#work {
  -webkit-user-select: none;
  user-select: none;
}
