/* ============================================================
   Optimize Outbound, Liam Redmond
   Palette: warm ink / bone / copper. Type: JetBrains Mono.
   ============================================================ */

@font-face {
  font-family: "JetBrains Mono";
  src: url("assets/fonts/jetbrains-mono.woff2?v=2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #131210;
  --char: #1c1a16;
  --bone: #e9e3d6;
  --smoke: #8f887b;
  --copper: #c4874f;
  --hairline: #2b2822;

  --font-mono: "JetBrains Mono", "SF Mono", Menlo, monospace;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --page-max: 80rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--ink);
  color: var(--bone);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.9 0 0 0 0 0.87 0 0 0 0 0.8 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--copper);
  color: var(--ink);
}

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

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 4px;
  border-radius: 1px;
}

/* ============ Masthead ============ */

.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9;
  padding: 1.125rem var(--gutter);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--smoke);
  background: rgba(19, 18, 16, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}

.masthead-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.masthead .wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--bone);
  transition: color 0.3s ease;
}

.masthead .wordmark:hover {
  color: var(--copper);
}

.masthead .wordmark:hover .logo path {
  stroke: var(--copper);
}

.logo {
  width: 2rem;
  height: 1.55rem;
  flex: none;
}

.logo path {
  stroke: var(--bone);
  stroke-width: 4;
  stroke-linejoin: round;
  transition: stroke 0.3s ease;
}

.masthead-nav {
  display: flex;
  gap: 2rem;
}

.masthead-link {
  white-space: nowrap;
  transition: color 0.3s ease;
}

.masthead-link:hover {
  color: var(--copper);
}

/* ============ Hero ============ */

.hero {
  position: relative;
  min-height: 62svh;
  max-width: var(--page-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  padding: 6rem var(--gutter) 1.5rem;
}

.hero-portrait {
  justify-self: end;
  max-width: 19rem;
}

.territory {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.territory svg {
  width: 100%;
  height: 100%;
  will-change: transform;
}

.territory path,
.territory circle,
.territory line {
  stroke: var(--copper);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.territory-west path,
.territory-east path,
.territory-south path {
  opacity: 0.16;
  fill: none;
}

.territory-lines .route {
  opacity: 0.12;
  stroke-dasharray: 3 7;
}

.territory-marks circle {
  fill: var(--copper);
  stroke: none;
  opacity: 0.35;
}

.hero-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: clamp(2.75rem, 11.5vw, 8.125rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.hero-name .line {
  display: block;
  overflow: hidden;
}

.hero-name .line:last-child {
  margin-left: clamp(1.5rem, 7vw, 9rem);
}

.hero-name .line-inner {
  display: inline-block;
}

.hero-tagline {
  margin-top: clamp(1.5rem, 4vh, 3rem);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(1.125rem, 2.2vw, 1.625rem);
  letter-spacing: -0.02em;
  color: var(--copper);
}

.hero-context {
  margin-top: 1.5rem;
  max-width: 38rem;
  color: var(--smoke);
  font-size: 0.9375rem;
}

/* ============ Section titles ============ */

.section-title {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.3vw, 1.75rem);
  letter-spacing: -0.02em;
  color: var(--bone);
  margin-bottom: 2rem;
}

/* ============ Services ============ */

.services {
  max-width: 68rem;
  margin: 0 auto;
  padding: clamp(1rem, 2vh, 1.5rem) var(--gutter) 0;
  scroll-margin-top: 4.5rem;
}

.services-lead {
  color: var(--smoke);
  max-width: 40rem;
  margin-bottom: 1.75rem;
}

.capability-grid {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.capability {
  border: 1px solid var(--hairline);
  transition: border-color 0.3s ease;
}

.capability:hover,
.capability.open {
  border-color: #4a4238;
}

.capability-head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  width: 100%;
  padding: 1.75rem 1.5rem;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.capability-head > svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--copper);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.capability-head > span:not(.capability-plus) {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--bone);
}

.capability-plus {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1rem;
  color: var(--smoke);
  transition: transform 0.3s ease, color 0.3s ease;
}

.capability.open .capability-plus {
  transform: rotate(45deg);
  color: var(--copper);
}

.capability-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}

.capability-body > p {
  overflow: hidden;
  color: var(--smoke);
  font-size: 0.875rem;
  margin: 0 1.5rem;
}

.capability.open .capability-body > p {
  margin-bottom: 1.5rem;
}

.capability.open .capability-body {
  grid-template-rows: 1fr;
}

/* ============ Contact ============ */

.contact {
  max-width: 68rem;
  margin: 0 auto;
  padding: clamp(6rem, 14vh, 10rem) var(--gutter);
  scroll-margin-top: 3rem;
}

.portrait {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--hairline);
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
}

.contact-list {
  list-style: none;
  padding: 0;
}

.contact-list li + li {
  margin-top: 0.5rem;
}

.contact-list a {
  position: relative;
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(1.625rem, 4.5vw, 3.25rem);
  line-height: 1.3;
  letter-spacing: -0.03em;
  transition: color 0.3s ease;
}

.contact-list a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0.125em;
  width: 100%;
  height: 1px;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.contact-list a:hover {
  color: var(--copper);
}

.contact-list a:hover::after {
  transform: scaleX(1);
}

.contact-icon {
  width: 0.55em;
  height: 0.55em;
  margin-left: 0.45em;
  vertical-align: 0.06em;
  fill: var(--smoke);
  transition: fill 0.3s ease;
}

.contact-list a:hover .contact-icon {
  fill: var(--copper);
}

.aside {
  margin-top: 4rem;
  text-align: right;
  font-size: 0.875rem;
  line-height: 2;
  color: var(--smoke);
}

.strava-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-weight: 500;
  transition: color 0.3s ease;
}

.strava-link svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.strava-link:hover {
  color: var(--copper);
}

/* ============ Footer ============ */

.footer {
  padding: 2rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--hairline);
  color: var(--smoke);
  font-size: 0.8125rem;
}

.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
}

/* ============ Motion ============ */

@media (prefers-reduced-motion: no-preference) {
  /* Page-load sequence: name settles, then tagline, then territory */
  .hero-name .line-inner {
    transform: translateY(110%);
    animation: rise 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .hero-name .line:nth-child(2) .line-inner {
    animation-delay: 0.12s;
  }

  .hero-tagline,
  .hero-context,
  .masthead {
    opacity: 0;
    animation: fade 1.2s ease 0.7s forwards;
  }

  .territory {
    opacity: 0;
    animation: fade 2.4s ease 0.4s forwards;
  }

  @keyframes rise {
    to { transform: translateY(0); }
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .capability-body,
  .capability-plus {
    transition: none;
  }
}

/* ============ Responsive ============ */

@media (max-width: 44rem) {
  .capability-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    align-content: center;
  }

  .hero-portrait {
    justify-self: start;
    max-width: 13rem;
  }

  .hero-name .line:last-child {
    margin-left: 0;
  }

  .aside {
    text-align: left;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.25rem;
  }
}

@media (max-width: 36rem) {
  .wordmark-text {
    display: none;
  }

  .masthead-nav {
    gap: 1.25rem;
  }
}
