/* =========================================================
   Marcus Castle — Personal Site
   Unified, readable style.css
   ========================================================= */

/* =========================
   Root, Resets, Tokens
   ========================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

:root {
  /* Colours */
  --text: #f9fafb;
  --overlay: rgba(0, 0, 0, .65);
  --brand-500: #2f6fed; /* primary blue */
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --ink: #0b1020;
  --ink-muted: #334155;
  --border: #e5e7eb;
  --surface: #ffffff;

  /* Layout constants */
  --footer-h: 100px;
  --header-h: 72px;

  /* Type scale */
  --fs-1: clamp(1rem, .9rem + .4vw, 1.25rem);
  --fs-2: clamp(1.25rem, 1rem + .8vw, 1.6rem);
  --fs-3: clamp(1.6rem, 1rem + 2vw, 2.2rem);
  --fs-4: clamp(2.2rem, 1.4rem + 3vw, 3.2rem);
}

/* Fixed-header offset for in-page anchors */
section[id] {
  scroll-margin-top: var(--header-h);
}

/* Utils */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--ink-muted);
}

.mt-2 {
  margin-top: .5rem;
}

/* =========================
   Header / Nav
   ========================= */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  background: rgba(0, 0, 0, .5);
}

.nav {
  position: relative; /* anchor for underline */
  max-width: 1200px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2rem;
  padding: 1rem 1rem;
}

.brand {
  margin-right: auto;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.menu {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.menu a {
  position: relative;
  padding: .4rem .7rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: color .2s;
}

.menu a:hover {
  color: #fff;
}

.menu a.active,
.menu a[aria-current="page"] {
  color: #fff;
}

.site-nav {
  position: relative;
}

/* Single underline bar — anchored to bottom of the header bar */
.nav-underline{
  position: absolute;
  left: 0;
  bottom: 0;                      /* stick to bottom of the black/white bar */
  height: 5px;                    /* requested thickness */
  width: 0;
  background: var(--brand-500);
  border-radius: 2px;
  transform: translateX(0);
  transition: transform 200ms ease, width 200ms ease, opacity 150ms ease;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  will-change: transform, width;
}

/* nav links should NOT have text underlines */
.menu a,
.nav .nav-link {
  text-decoration: none;
}

/* Header contrast on scroll */
.site-header.scrolled {
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border);
}

.site-header.scrolled .brand,
.site-header.scrolled .menu a {
  color: var(--ink);
}

.site-header.scrolled .menu a:hover {
  color: var(--ink);
}

/* Mobile menu button */
.menu-toggle {
  display: none;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, .35);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: .35rem .6rem;
  font-size: 1.1rem;
  cursor: pointer;
}

/* Header responsive */
@media (max-width: 800px) {
  .nav {
    justify-content: space-between;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
  }

  .menu {
    display: none;
    position: absolute;
    top: 64px;
    right: 1rem;
    left: 1rem;
    flex-direction: column;
    gap: .75rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(6px);
  }

  .menu[data-open="true"] {
    display: flex;
  }
}

/* =========================
   Sections (general)
   ========================= */
.section-full {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 4rem 1rem;
  position: relative;
}

.section-inner {
  max-width: 1200px;
  margin: auto;
  text-align: center;
  color: var(--ink);
}

.section-intro {
  max-width: min(70ch, 90vw);
  margin: 0 auto 2rem;
  opacity: .95;
}

/* =========================
   Hero
   ========================= */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 6rem 1.5rem;
  text-align: center;
  color: var(--text);
  background-image:
    linear-gradient(rgba(0, 0, 0, .45), rgba(0, 0, 0, .45)),
    url("/assets/img/header-bg-3000-crummock.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero__inner {
  max-width: 880px;
  width: 100%;
}

.hero__title {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  margin: 0 0 .25rem;
  color: #fff;
}

.hero__role {
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  font-weight: 600;
  opacity: .85;
  margin: 0 0 1.25rem;
  color: #fff;
}

.hero__summary {
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  line-height: 1.65;
  margin: 0;
  color: #fff;
}

.hero__actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 50px;
  gap: 0;
  flex-wrap: wrap;
}

/* Pipe with 50px padding each side */
.hero-btn-sep {
  display: inline-block;
  padding-inline: 50px;
  font-size: 1.25rem;
  line-height: 1;
  opacity: .4;
}

/* Hero-only buttons (scoped) */
.hero-btn {
  --pad-y: 0.9rem;
  --pad-x: 1.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-y) var(--pad-x);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  line-height: 1;
  border: 2px solid transparent;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.hero-btn--primary {
  background: var(--brand-500);
  color: #fff;
  box-shadow: 0 6px 18px rgba(47, 111, 237, .25);
}

.hero-btn--primary:hover,
.hero-btn--primary:focus-visible {
  background: #2456ba;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(36, 86, 186, .35);
}

.hero-btn--secondary {
  background: transparent;
  color: #fff;
  border-color: #d0d7e2;
}

.hero-btn--secondary:hover,
.hero-btn--secondary:focus-visible {
  border-color: var(--brand-500);
  color: var(--brand-500);
}

@media (prefers-reduced-motion: reduce) {
  .hero-btn { transition: none; }
}

@media (max-width: 640px) {
  .hero__actions { flex-direction: column; gap: 12px; }
  .hero-btn-sep { display: none; }
}

/* =========================
   Case Studies (cards)
   ========================= */
#case-studies.section-full {
  background: #fff;
  color: var(--ink);
}

#case-studies .section-intro {
  color: var(--ink-muted);
  font-size: var(--fs-1);
}

#case-studies h2 {
  font-size: var(--fs-4);
}

/* CTA button on cards */
.btn-primary {
  display: inline-block;
  padding: .7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--brand-600);
  background: var(--brand-600);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .25);
  transition: transform .12s, box-shadow .12s, background .12s;
}

.btn-primary:hover {
  background: var(--brand-700);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(29, 78, 216, .3);
}

/* Cards grid */
.cards-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1100px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .cards-grid { grid-template-columns: 1fr; }
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .06);
  transition: transform .18s, box-shadow .18s, border-color .18s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(2, 6, 23, .12);
  border-color: var(--brand-500);
}

.card h3 {
  margin: .25rem 0;
  font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem);
}

.card p {
  margin: 0;
  color: var(--ink-muted);
}

/* Thumbnail framed */
.card-thumb {
  width: 100%;
  height: 200px;
  padding: 10px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: block;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .25rem;
}

.tag {
  font-size: .82rem;
  background: #f1f5f9;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .18rem .55rem;
}

/* Pager */
.cs-controls, .t-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: 1rem;
}

.cs-nav, .t-nav {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--brand-600);
  background: transparent;
  color: var(--brand-600);
  cursor: pointer;
}

.cs-nav[disabled],
.t-nav[disabled] {
  opacity: .5;
  cursor: not-allowed;
}

.cs-counter,
.t-counter {
  color: var(--ink-muted);
  font-size: .95rem;
}

/* =========================
   Testimonials
   ========================= */
#testimonials.section-full {
  background: linear-gradient(180deg, #f5f7fa 0%, #fff 100%);
  color: var(--ink);
}

#testimonials h2 {
  font-size: var(--fs-4);
  margin: 0 0 .75rem;
}

#testimonials .section-intro {
  color: var(--ink-muted);
  font-size: var(--fs-1);
}

.t-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
  align-items: start;
}

@media (max-width: 900px) {
  .t-grid { grid-template-columns: 1fr; }
}

.t-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: calc(1rem + 10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .06);
  display: flex;
  flex-direction: column;
  gap: .75rem;
  text-align: left;
}

.t-head {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 20px;
  align-items: center;
}

.t-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #e5e7eb;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
}

.t-name {
  font-weight: 700;
  color: var(--ink);
}

.t-title {
  color: var(--ink-muted);
  font-size: .95rem;
  margin-top: .15rem;
}

.t-body {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  margin-top: .5rem;
}

/* =========================
   Contact
   ========================= */
#contact.section-full {
  background: #fff;
  color: var(--ink);
}

.contact {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
}

.contact__inner {
  width: 100%;
  max-width: 1100px;
}

.contact__title {
  text-align: center;
  font-size: var(--fs-4, clamp(1.75rem, 3vw, 2.25rem));
  margin: 0;
}

.contact__rule {
  border: 0;
  height: 1px;
  background: rgba(0, 0, 0, 0.12);
  margin: 30px 0;
}

/* Media intro: avatar + text with 50px gap */
.contact__introMedia {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 50px;
  max-width: 900px;
  margin: 0 auto;
  text-align: left;
}

.contact__avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
  border: 2px solid rgba(255, 255, 255, .75);
}

.contact__intro {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
  line-height: 1.6;
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  opacity: .95;
  color: inherit;
}

/* On desktop intro text aligns left within media block */
@media (min-width: 721px) {
  .contact__intro { text-align: left; }
}

/* Grid */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px; /* exact gap */
  align-items: stretch;
  margin-top: .5rem;
}

.contact__col {
  display: flex;
  min-width: 0;
  min-height: 1px;
}

.contact-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  padding: 1.25rem 1.25rem 1.1rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.contact-panel__title {
  margin: 0;
  font-size: clamp(1.05rem, 1.6vw, 1.15rem);
  font-weight: 700;
}

.contact-panel__body {
  flex: 1;
}

.contact-panel__footer {
  display: flex;
  justify-content: flex-start;
  gap: 12px;
}

.contact__blurb {
  margin: 0 0 1rem;
  line-height: 1.7;
  color: inherit;
}

.contact__blurb a {
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}

.contact__blurb a:hover,
.contact__blurb a:focus-visible {
  border-bottom-color: currentColor;
}

/* Contact buttons (scoped) */
.contact-btn {
  --pad-y: .85rem;
  --pad-x: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad-y) var(--pad-x);
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  line-height: 1;
  border: 2px solid transparent;
  transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}

.contact-btn--primary {
  background: var(--brand-500);
  color: #fff;
  box-shadow: 0 6px 18px rgba(47, 111, 237, .2);
}

.contact-btn--primary:hover,
.contact-btn--primary:focus-visible {
  background: #2456ba;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(36, 86, 186, .28);
}

/* Contact responsive */
@media (max-width: 820px) {
  .contact__grid { grid-template-columns: 1fr; }
  .contact__title, .contact__intro { text-align: left; }
  .contact__introMedia { flex-direction: column; gap: 16px; text-align: center; }
}

/* Extra breathing room beneath Contact when footer is revealed */
body.footer-visible #contact .contact__inner {
  padding-bottom: calc(var(--footer-h) + 10px); /* buffer above the fixed footer */
}

@media (max-width: 820px) {
  body.footer-visible #contact .contact__inner {
    padding-bottom: calc(var(--footer-h) + 10px);
  }
}

/* =========================
   Footer (revealed on Contact only)
   ========================= */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-h);
  background: #000;
  color: #fff;
  z-index: 5;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s, opacity .25s;
}

body.footer-visible .site-footer {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
}

.footer-inner a {
  color: #fff;
  text-decoration: none;
  opacity: .9;
}

.footer-inner a:hover {
  opacity: 1;
  text-decoration: underline;
}

/* =========================
   Case Study template page
   ========================= */
.cs-wrap {
  max-width: min(70vw, 1200px);
  margin: 0 auto;
  padding: 2rem 1rem 0;
}

.case-title {
  font-size: var(--fs-4);
  margin: 6rem 0 .75rem; /* space for fixed header */
  text-align: left;
  color: var(--ink);
}

.case-sub {
  margin: 0 0 .75rem;
  color: var(--ink-muted);
  font-size: var(--fs-1);
}

.cs-wrap .tags {
  margin-top: .25rem;
  justify-content: flex-start;
}

.cs-hero {
  display: block;
  margin: 1rem auto calc(1.25rem + 50px);
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.cs-section {
  margin: 1.25rem 0;
  text-align: left;
}

.cs-section h2 {
  font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem);
  margin: 0 0 .35rem;
  color: var(--ink);
}

.cs-section p {
  font-size: 1rem;
  margin: .5rem 0;
  color: var(--ink);
}

.cs-content ul {
  padding-left: 1.25rem;
  margin: .25rem 0 .75rem;
}

.cs-content li {
  margin: .2rem 0;
}

.cs-back {
  margin: 50px 0;
}

.footer-spacer {
  height: var(--footer-h);
}

.cs-page .nav {
  max-width: min(70vw, 1200px);
}
