/* ==========================================================================
   Danny McMahon | Freelance marketing site
   Easy edits: colors, fonts, and spacing all live in the :root block below.
   ========================================================================== */

:root {
  /* Color */
  --paper: #F3F4F1;       /* page background */
  --paper-2: #FAFAF8;     /* form fields */
  --ink: #1D1E20;         /* text, dark panel */
  --muted: #5B5E65;       /* secondary text */
  --rule: #D3D5D0;        /* hairlines */
  --stone: #E7E8E3;       /* quiet panel fill */
  --accent: #2540D9;      /* the one accent: proofreader's blue */
  --accent-dark: #1B30AE;
  --tint: #E2E7FB;        /* pale accent for the Brand panel */

  /* Type */
  --font-display: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --font-text: "DM Sans", "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 78rem;
  --nav-h: 4rem;
  --radius: 3px;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@media (min-width: 52rem) {
  body { font-size: 1.125rem; }
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-optical-sizing: auto;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p { margin: 0 0 1.1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

ul, ol { margin: 0; padding: 0; list-style: none; }
dl, dd { margin: 0; }

a { color: inherit; }

img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection { background: var(--accent); color: #fff; }

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

/* Inline links: a quiet blue underline that thickens on hover */
.link {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness 0.15s ease, color 0.15s ease;
}
.link:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.85rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}
.btn--primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn--small {
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* ---------- Header / navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(243, 244, 241, 0.92);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--rule); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-h);
}

.nav__brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav__toggle {
  padding: 0.5rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
}

/* Mobile menu: drops down under the header */
.nav__links {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  padding: 0.25rem var(--gutter) 1.5rem;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.site-header.is-open .nav__links { display: flex; }

.nav__links a:not(.btn) {
  display: block;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  text-decoration: none;
}
.nav__links li:last-child { margin-top: 1.25rem; }
.nav__links .btn { display: block; }

@media (min-width: 52rem) {
  .nav__toggle { display: none; }

  .nav__links {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    padding: 0;
    background: none;
    border: 0;
  }

  .nav__links a:not(.btn) {
    padding: 0.25rem 0;
    border: 0;
    font-size: 0.975rem;
    color: var(--muted);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.45em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
  }
  .nav__links a:not(.btn):hover { color: var(--ink); }
  .nav__links a[aria-current="true"] {
    color: var(--ink);
    text-decoration-color: var(--accent);
  }

  .nav__links li:last-child { margin-top: 0; }
  .nav__links .btn { display: inline-block; }
}

/* ---------- Hero ---------- */

.hero {
  padding-block: clamp(3.5rem, 9vw, 7.5rem) clamp(4rem, 8vw, 7rem);
}

.hero__title {
  max-width: 15.5em;
  font-size: clamp(2.8rem, 8.4vw, 7.25rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.045em;
}

.hero__rest {
  display: grid;
  gap: 3rem;
  margin-top: clamp(2.5rem, 6vw, 5rem);
}

.hero__lede {
  max-width: 34rem;
  font-size: 1.1875rem;
  line-height: 1.55;
}

@media (min-width: 52rem) {
  .hero__lede { font-size: 1.3125rem; }
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hero__facts {
  display: grid;
  gap: 1.25rem;
  align-content: start;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ink);
}

.hero__facts dt {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--muted);
}
.hero__facts dd {
  font-size: 1.05rem;
  line-height: 1.4;
}

@media (min-width: 52rem) {
  .hero__rest {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    gap: 5rem;
    align-items: start;
  }
  .hero__facts { margin-top: 0.4rem; }
}

/* The one orchestrated moment: headline words rise into place on load */
@media (prefers-reduced-motion: no-preference) {
  .js .hero__title .w {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    padding-bottom: 0.14em;
    margin-bottom: -0.14em;
  }
  .js .hero__title .w > span {
    display: inline-block;
    transform: translateY(110%);
    animation: rise 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
    animation-delay: calc(var(--i, 0) * 70ms + 120ms);
  }
  .js .hero__rest {
    opacity: 0;
    animation: fade-in 0.9s ease 0.85s forwards;
  }
}

@keyframes rise { to { transform: none; } }
@keyframes fade-in { to { opacity: 1; } }

/* ---------- Sections ---------- */

.section {
  padding-block: clamp(4.5rem, 9vw, 8rem);
}
.section--rule {
  border-top: 1px solid var(--ink);
}
.section--last {
  padding-bottom: clamp(5rem, 10vw, 9rem);
}

.section__head {
  display: grid;
  gap: 1rem 3rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.section__head h2 {
  font-size: clamp(2rem, 3.6vw, 2.9rem);
}
.section__head p {
  max-width: 36rem;
  color: var(--muted);
}

@media (min-width: 56rem) {
  .section__head {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
  }
  .section__head h2 { grid-column: 1 / 6; }
  .section__head p { grid-column: 7 / 13; }
}

/* ---------- Services ---------- */

.services {
  display: grid;
  gap: 1rem;
}

@media (min-width: 52rem) {
  .services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
  }
}

.panel {
  --bg: transparent;
  --fg: var(--ink);
  --soft: var(--muted);
  --line: var(--rule);
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  background: var(--bg);
  color: var(--fg);
  border-radius: var(--radius);
}

.panel h3 { margin-bottom: 0.85rem; }

.panel > p {
  color: var(--soft);
  margin-bottom: 1.75rem;
}

.panel__list {
  margin-top: auto;
  border-top: 1px solid var(--line);
}
.panel__list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 450;
  letter-spacing: -0.005em;
}

/* Core panels: bigger and bolder */
.panel--core { padding: clamp(1.75rem, 3.2vw, 2.5rem); }
.panel--core h3 { font-size: clamp(1.9rem, 3vw, 2.5rem); }
.panel--core > p { font-size: 1.1rem; }
.panel--core .panel__list li { padding-block: 0.7rem; font-size: 1.05rem; }

/* Support panels: smaller and quieter */
.panel--support h3 { font-size: clamp(1.4rem, 2vw, 1.65rem); }
.panel--support > p { font-size: 1rem; }
.panel--support .panel__list li { font-size: 0.95rem; }

/* Four different surfaces */
.panel--content {
  --bg: var(--ink);
  --fg: var(--paper);
  --soft: #BDBFC4;
  --line: rgba(243, 244, 241, 0.2);
}
.panel--brand {
  --bg: var(--tint);
  --soft: #434857;
  --line: rgba(29, 30, 32, 0.2);
}
.panel--social {
  border: 1px solid var(--ink);
}
.panel--projects {
  --bg: var(--stone);
  --line: rgba(29, 30, 32, 0.15);
}

/* ---------- Selected work ---------- */

.work { border-top: 1px solid var(--rule); }

.work-item {
  display: grid;
  gap: 1.25rem;
  padding-block: 2rem;
  border-bottom: 1px solid var(--rule);
}

.work-item__type {
  margin-bottom: 0.4rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}
.work-item__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--muted);
}

.work-item__body h3 {
  margin-bottom: 0.6rem;
  font-size: clamp(1.45rem, 2.4vw, 2rem);
}
.work-item__body p {
  max-width: 34rem;
  color: var(--muted);
}

.result__fig {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 5.2vw, 4.25rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  font-variant-numeric: lining-nums;
}
.result__label {
  margin: 0.45rem 0 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
}
.result__extra {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

@media (min-width: 56rem) {
  .work-item {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0 3rem;
    padding-block: 2.5rem;
    align-items: start;
  }
  .work-item__meta { grid-column: 1 / 4; }
  .work-item__skills { flex-direction: column; gap: 0.15rem; }
  .work-item__body { grid-column: 4 / 9; }
  .work-item__result { grid-column: 9 / 13; }
}

/* ---------- About ---------- */

.about {
  display: grid;
  gap: 2rem;
}

.about__statement {
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.about__body { max-width: 38rem; }
.about__body p { margin-bottom: 1.2em; }

.about__tools {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--muted);
}

@media (min-width: 56rem) {
  .about {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0 3rem;
  }
  .about__statement { grid-column: 1 / 7; }
  .about__body { grid-column: 8 / 13; margin-top: 0.6rem; }
}

/* ---------- Process ---------- */

.steps {
  display: grid;
  gap: 2.5rem;
}

.step {
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.step__num {
  display: block;
  margin-bottom: 1.5rem;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  font-variant-numeric: lining-nums;
}

.step h3 {
  margin-bottom: 0.6rem;
  font-size: 1.5rem;
}
.step p {
  max-width: 24rem;
  color: var(--muted);
}

@media (min-width: 52rem) {
  .steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3rem;
  }
}

/* ---------- Contact ---------- */

.contact {
  display: grid;
  gap: 3rem;
}

.contact__intro h2 {
  margin-bottom: 1.5rem;
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  line-height: 1.03;
  letter-spacing: -0.035em;
}
.contact__intro p { max-width: 28rem; }
.contact__intro strong {
  font-weight: 600;
}
.contact__email {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 1rem;
}

@media (min-width: 56rem) {
  .contact {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0 3rem;
  }
  .contact__intro { grid-column: 1 / 6; }
  .form-wrap { grid-column: 7 / 13; }
}

/* Form */

.form { display: grid; gap: 1.25rem; }

.form__row {
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 40rem) {
  .form__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
}
.optional {
  font-weight: 400;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid #8A8D93;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1rem; /* 16px+ stops iOS zooming on focus */
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea { resize: vertical; min-height: 9rem; }

.field input::placeholder { color: #767980; }

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--ink); }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 64, 217, 0.22);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231D1E20' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.95rem center;
}

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

.form__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-top: 0.25rem;
}

.form__status {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--muted);
}
.form__status.is-error { color: #A12727; }

.form__thanks {
  padding: clamp(1.75rem, 3vw, 2.5rem);
  background: var(--tint);
  border-radius: var(--radius);
}
.form__thanks[hidden] { display: none; }
.form__thanks h3 {
  margin-bottom: 0.75rem;
  font-size: 1.75rem;
}
.form__thanks:focus { outline: none; }

.form-wrap.is-sent .form { display: none; }

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--muted);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
}
.site-footer p { margin: 0; }
.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

/* ---------- Print ---------- */

@media print {
  .site-header, .skip-link, .form-wrap { display: none; }
  body { background: #fff; }
}

/* Featured case study (single project with several figures) */

.work-item--feature .work-item__body p { max-width: 38rem; }
.work-item--feature .work-item__body p + p { margin-top: 1em; }

.figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem 1.5rem;
  margin-top: 1rem;
}
.figure {
  padding-top: 1rem;
  border-top: 1px solid var(--ink);
}

@media (min-width: 56rem) {
  .work-item--feature .work-item__body { grid-column: 4 / 13; }
  .figures {
    grid-column: 4 / 13;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 2rem;
    margin-top: 2.75rem;
  }
}
