/* ==========================================================================
   Solera — Design Tokens
   ========================================================================== */

:root {
  /* Colour palette */
  --parchment: #F5F1EB;
  --parchment-dark: #EDE8E0;
  --ink: #1A1814;
  --terracotta: #8B4A35;
  --ochre: #C4A070;
  --warm-grey: #6B6560;
  --mid-grey: #625D58;
  --divider: #EDE8E0;

  /* Typography */
  --sans: 'Plus Jakarta Sans', sans-serif;
  --serif: 'Cormorant', serif;

  /* Spacing */
  --page-padding: clamp(24px, 4vw, 48px);
  --section-gap: clamp(32px, 4vw, 48px);

  /* Layout */
  --content-width: 1080px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--sans);
  background: var(--parchment);
  color: var(--ink);
  line-height: 1.6;
}

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

/* Skip navigation */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--page-padding);
  z-index: 100;
  padding: 8px 16px;
  background: var(--ink);
  color: var(--parchment);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 0 0 4px 4px;
}

.skip-link:focus {
  top: 0;
}

/* Focus indicators */
:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
  border-radius: 2px;
}

a:focus-visible {
  outline-offset: 4px;
}

/* ==========================================================================
   Typography
   ========================================================================== */

.label {
  font-family: var(--sans);
  font-size: clamp(11px, 0.75vw, 12px);
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--terracotta);
}

.display {
  font-family: var(--serif);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.2;
  color: var(--ink);
}

.heading {
  font-family: var(--sans);
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.body-text {
  font-family: var(--sans);
  font-size: clamp(14px, 1.2vw, 15px);
  font-weight: 400;
  line-height: 1.85;
  color: var(--ink);
}

.body-text--secondary {
  color: var(--warm-grey);
}

.caption {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--warm-grey);
}

.small {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.8;
  color: var(--warm-grey);
}

/* ==========================================================================
   Brand Elements
   ========================================================================== */

.gradient-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--terracotta), var(--ochre));
}

.section-bar {
  width: 40px;
  height: 3px;
  background: var(--terracotta);
}

.divider {
  height: 1px;
  background: var(--divider);
}

/* Paper grain texture */
.grain {
  position: relative;
}

.grain::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
}

.grain--dark::after {
  opacity: 0.04;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px var(--page-padding);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.wordmark {
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.25em;
  color: var(--ink);
}

.nav {
  display: flex;
  gap: clamp(16px, 2.5vw, 32px);
}

.nav a {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mid-grey);
  transition: color 0.2s;
  padding: 8px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

.nav a.active {
  color: var(--ink);
  font-weight: 600;
}

.footer-wrap {
  border-top: 1px solid var(--divider);
}

.footer {
  padding: 20px var(--page-padding);
  display: flex;
  justify-content: space-between;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.footer span {
  font-size: 12px;
  color: var(--mid-grey);
}

/* Title blocks — full-bleed background, contained content */
.title-block {
  padding: var(--page-padding);
  padding-left: max(var(--page-padding), calc((100% - var(--content-width)) / 2 + var(--page-padding)));
  padding-right: max(var(--page-padding), calc((100% - var(--content-width)) / 2 + var(--page-padding)));
}

.title-block--terracotta {
  background: var(--terracotta);
  color: var(--parchment);
}

.title-block--ink {
  background: var(--ink);
  color: var(--parchment);
  position: relative;
}

h1.title-block__number,
.title-block__number {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--parchment);
  opacity: 0.6;
  margin-bottom: 12px;
}

.title-block--ink .title-block__number {
  color: var(--ochre);
  opacity: 1;
}

.title-block__title {
  font-family: var(--sans);
  font-size: clamp(28px, 3.5vw, 36px);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--parchment);
}

.title-block__subtitle {
  font-size: 13px;
  color: var(--ochre);
  margin-top: 8px;
}

/* Two-column interior layout */
.interior {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--section-gap);
  padding: var(--page-padding);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.sidebar {
  position: sticky;
  top: 32px;
  align-self: start;
}

.sidebar__label {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--terracotta);
  font-weight: 600;
  margin-bottom: 16px;
}

.sidebar__link {
  display: block;
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 0;
  color: var(--warm-grey);
}

.sidebar__link.active {
  color: var(--ink);
  font-weight: 600;
}

/* Content sections */
.section {
  margin-bottom: clamp(32px, 4vw, 48px);
}

.section + .section {
  padding-top: clamp(24px, 3vw, 36px);
  border-top: 1px solid var(--divider);
}

h2.section__label,
h3.section__label,
h1.section__label,
.section__label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--terracotta);
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
}

h3.service__title {
  font-family: var(--sans);
}

.section__bar {
  width: 40px;
  height: 3px;
  background: var(--terracotta);
  margin-bottom: 20px;
}

.section__lead {
  font-family: var(--serif);
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.35;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 16px;
  max-width: min(480px, 100%);
}

.section__body {
  font-size: clamp(13px, 1.1vw, 14px);
  line-height: 1.85;
  color: var(--ink);
  max-width: min(480px, 100%);
}

/* Dark callout block */
.callout {
  background: var(--ink);
  padding: 32px;
  border-radius: 4px;
  position: relative;
  margin-bottom: 24px;
}

.callout .section__label {
  color: var(--terracotta);
}

.callout .section__lead {
  color: var(--parchment);
  font-size: 18px;
}

/* Services grid */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.service__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.service__desc {
  font-size: 12px;
  line-height: 1.7;
  color: var(--warm-grey);
}

/* CTA link */
.cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  min-height: 44px;
}

.cta__text {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--ink);
  border-bottom: 1.5px solid var(--terracotta);
  padding-bottom: 2px;
}

.cta__arrow {
  font-size: 14px;
  color: var(--terracotta);
}

/* Homepage hero */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--page-padding) clamp(48px, 8vw, 80px);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.hero .label {
  margin-bottom: clamp(16px, 2vw, 24px);
}

.hero .display {
  max-width: min(640px, 100%);
  margin-bottom: clamp(20px, 3vw, 32px);
}

.hero .body-text {
  max-width: min(520px, 100%);
  margin-bottom: clamp(28px, 3.5vw, 40px);
}

/* Content area (non-sidebar pages) */
.content {
  padding: var(--page-padding);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* Contact page */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 5vw, 64px);
  align-items: start;
  width: 100%;
}

.contact-main {
  flex: 1;
  display: flex;
  align-items: center;
  padding: var(--page-padding);
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

.contact-display {
  font-size: clamp(22px, 3vw, 28px);
  margin-bottom: 20px;
  max-width: min(440px, 100%);
}

.contact-body {
  max-width: min(400px, 100%);
}

.contact-detail {
  margin-bottom: 32px;
}

.contact-detail__label {
  font-size: 11px;
  letter-spacing: 0.25em;
  color: var(--mid-grey);
  margin-bottom: 8px;
}

.contact-detail__value {
  font-size: 15px;
  color: var(--ink);
}

.contact-detail__sub {
  font-size: 13px;
  color: var(--warm-grey);
  margin-top: 4px;
}

.contact-email {
  font-size: 15px;
  color: var(--ink);
  border-bottom: 1.5px solid var(--terracotta);
  padding-bottom: 2px;
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
}

/* About page */
.partners-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(24px, 3.5vw, 40px);
  margin-top: 24px;
}

.about-body {
  max-width: min(520px, 100%);
}

.about-body .section__body + .section__body {
  margin-top: 12px;
}

/* Work page */
.content > .section__label {
  margin-bottom: 24px;
}

.work-row {
  border-top: 1px solid var(--divider);
  padding: 28px 0;
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 32px;
  align-items: start;
}

.work-row--ghost .work-row__title,
.work-row--ghost .small,
.work-row--ghost .work-row__year {
  color: var(--mid-grey);
}

.work-row__year {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--mid-grey);
}

.work-row__status {
  font-size: 11px;
  color: var(--mid-grey);
  margin-top: 2px;
}

.work-row__title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.work-row__tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.work-row__cta {
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--terracotta);
  font-weight: 600;
  padding: 8px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* Partnership page callout */
.callout__lead {
  color: var(--parchment);
  font-size: 18px;
  margin-top: 12px;
}

.section__body + .section__body {
  margin-top: 16px;
}

/* Tags (Work page) */
.tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border: 1px solid var(--divider);
  border-radius: 2px;
  color: var(--mid-grey);
}

/* Partner cards (About page) */
.partner {
  border-top: 4px solid var(--terracotta);
  padding-top: 20px;
}

.partner__name {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.partner__role {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--terracotta);
  margin-bottom: 16px;
}

.partner__desc {
  font-size: 13px;
  line-height: 1.8;
  color: var(--warm-grey);
}

/* ==========================================================================
   Animation — Easing & Tokens
   ========================================================================== */

:root {
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --duration-entrance: 600ms;
  --duration-hover: 200ms;
  --stagger: 120ms;
}

/* ==========================================================================
   Animation — Page Load (Hero)
   ========================================================================== */

.hero > * {
  opacity: 0;
  transform: translateY(16px);
  animation: settle var(--duration-entrance) var(--ease-out-expo) forwards;
}

.hero > *:nth-child(1) { animation-delay: 100ms; }
.hero > *:nth-child(2) { animation-delay: 250ms; }
.hero > *:nth-child(3) { animation-delay: 400ms; }
.hero > *:nth-child(4) { animation-delay: 550ms; }

@keyframes settle {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header entrance */
.header {
  opacity: 0;
  animation: fadeIn 500ms var(--ease-out-expo) 50ms forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Gradient bar draw */
.gradient-bar {
  transform: scaleX(0);
  transform-origin: left;
  animation: drawBar 800ms var(--ease-out-expo) forwards;
}

@keyframes drawBar {
  to { transform: scaleX(1); }
}

/* ==========================================================================
   Animation — Title Block Stagger
   ========================================================================== */

.title-block > * {
  opacity: 0;
  transform: translateY(10px);
  animation: settle var(--duration-entrance) var(--ease-out-expo) forwards;
}

.title-block > *:nth-child(1) { animation-delay: 100ms; }
.title-block > *:nth-child(2) { animation-delay: 220ms; }
.title-block > *:nth-child(3) { animation-delay: 340ms; }

/* ==========================================================================
   Animation — Scroll Reveal
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-entrance) var(--ease-out-expo),
              transform var(--duration-entrance) var(--ease-out-expo);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children within a revealed section */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 500ms var(--ease-out-expo),
              transform 500ms var(--ease-out-expo);
}

.reveal-stagger.is-visible > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0ms; }
.reveal-stagger.is-visible > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 80ms; }
.reveal-stagger.is-visible > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 160ms; }
.reveal-stagger.is-visible > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 240ms; }
.reveal-stagger.is-visible > *:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 320ms; }
.reveal-stagger.is-visible > *:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 400ms; }

/* ==========================================================================
   Animation — Micro-interactions
   ========================================================================== */

/* Nav link underline */
.nav a {
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--duration-hover) var(--ease-out-quart);
}

.nav a:hover::after,
.nav a.active::after {
  transform: scaleX(1);
}

/* CTA arrow nudge */
.cta__arrow {
  transition: transform var(--duration-hover) var(--ease-out-quart);
}

.cta:hover .cta__arrow {
  transform: translateX(4px);
}

/* Work row CTA arrow nudge */
.work-row__cta {
  transition: color var(--duration-hover) var(--ease-out-quart);
}

.work-row__cta:hover {
  color: var(--ink);
}

/* Sidebar link */
.sidebar__link {
  transition: color var(--duration-hover) var(--ease-out-quart);
}

/* Section bar grow on reveal */
.section__bar {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 500ms var(--ease-out-expo);
}

.is-visible .section__bar,
.hero .section__bar,
.contact-main .section__bar {
  transform: scaleX(1);
}

/* First section on page loads visible (not scroll-triggered) */
.section:first-child .section__bar {
  animation: drawBar 600ms var(--ease-out-expo) 300ms forwards;
}

/* Contact grid entrance */
.contact-grid > * {
  opacity: 0;
  transform: translateY(16px);
  animation: settle var(--duration-entrance) var(--ease-out-expo) forwards;
}

.contact-grid > *:nth-child(1) { animation-delay: 200ms; }
.contact-grid > *:nth-child(2) { animation-delay: 400ms; }

/* Contact email hover */
.contact-email {
  transition: color var(--duration-hover) var(--ease-out-quart);
}

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

/* Partner card top border */
.partner {
  transition: border-color 300ms var(--ease-out-quart);
}

.partner:hover {
  border-color: var(--ochre);
}

/* ==========================================================================
   Animation — Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero > *,
  .header,
  .title-block > *,
  .reveal,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
  }

  .gradient-bar {
    transform: scaleX(1);
  }
}

/* ==========================================================================
   Responsive — Tablet (≤ 1024px)
   ========================================================================== */

@media (max-width: 1024px) {
  /* Contact — anchor content higher on tablet */
  .contact-main {
    align-items: flex-start;
    padding-top: clamp(40px, 6vw, 64px);
  }

  /* Sidebar layout gets tight — collapse to stacked */
  .interior {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: flex;
    gap: 8px 20px;
    flex-wrap: wrap;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--divider);
  }

  .sidebar__label {
    width: 100%;
  }

  .sidebar__link {
    line-height: 1.4;
    padding: 6px 0;
  }
}

/* ==========================================================================
   Responsive — Mobile (≤ 640px)
   ========================================================================== */

@media (max-width: 640px) {
  /* Header — stack wordmark and nav */
  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-top: 24px;
    padding-bottom: 24px;
  }

  /* Nav — wrap gracefully, ensure touch targets */
  .nav {
    gap: 0 16px;
    flex-wrap: wrap;
  }

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

  /* Services grid — single column */
  .services-grid {
    grid-template-columns: 1fr;
  }

  /* Footer */
  .footer {
    flex-direction: column;
    gap: 4px;
    padding: 16px var(--page-padding);
  }

  /* Work page rows — stack columns */
  .work-row {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 24px 0;
  }

  .work-row__year {
    margin-bottom: 0;
  }

  /* Contact page — stack and top-align */
  .contact-main {
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: clamp(32px, 6vw, 48px);
    padding-bottom: clamp(32px, 6vw, 48px);
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .contact-display {
    font-size: clamp(22px, 5vw, 28px);
  }

  /* About partners — stack */
  .partners-grid {
    grid-template-columns: 1fr;
  }

  /* Hero — center on mobile, not bottom-anchored */
  .hero {
    justify-content: center;
    padding-top: clamp(40px, 10vw, 80px);
    padding-bottom: clamp(40px, 8vw, 64px);
  }

  /* Title block — simplify padding on mobile */
  .title-block {
    padding: 24px var(--page-padding);
    padding-left: var(--page-padding);
    padding-right: var(--page-padding);
  }
}

/* ==========================================================================
   Responsive — Small phones (≤ 380px)
   ========================================================================== */

@media (max-width: 420px) {
  .nav a {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .work-row__title {
    font-size: 16px;
  }

  .partner__name {
    font-size: 16px;
  }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  .gradient-bar,
  .skip-link,
  .grain::after {
    display: none;
  }

  .page {
    min-height: auto;
  }

  .header {
    padding-bottom: 16px;
    border-bottom: 1px solid #ccc;
  }

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

  .section {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a[href^="mailto"]::after {
    content: " (" attr(href) ")";
    font-size: 12px;
    color: var(--warm-grey);
  }
}
