/* ==========================================================================
   SOURCE2SEA — styles.css
   CSS Variables, Reset, and Global Styles
   Adventure with Purpose — raising funds for the MS Society
   ========================================================================== */


/* ==========================================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ========================================================================== */

:root {
  /* --- Colour: Primary Accent --- */
  --colour-orange:        #E35205; /* MS Society orange — primary CTA, highlights, accents */
  --colour-orange-dark:   #c44804; /* Hover state for orange */
  --colour-orange-light:  #f07040; /* Softer orange for subtle tints */

  /* --- Colour: Dark Tones --- */
  --colour-dark-1:        #1a1510; /* Deepest — hero backgrounds, footer */
  --colour-dark-2:        #2c2318; /* Rich dark brown — secondary dark sections */
  --colour-dark-3:        #3d3025; /* Mid dark — cards on dark backgrounds */

  /* --- Colour: Light/Warm Tones --- */
  --colour-light-1:       #f5f0e8; /* Primary light background — warm off-white */
  --colour-light-2:       #ede7db; /* Slightly deeper warm cream */
  --colour-light-3:       #ddd5c5; /* Warm stone — dividers, subtle backgrounds */

  /* --- Colour: Accent Neutrals --- */
  --colour-moss:          #5a6b4a; /* Muted green — nature, discipline tags */
  --colour-slate:         #4a5568; /* Cool dark slate — secondary text */
  --colour-tawny:         #8b6a3e; /* Warm brown — decorative accents */

  /* --- Colour: Text --- */
  --colour-text-dark:     #1a1510; /* Primary body text on light backgrounds */
  --colour-text-mid:      #4a3f32; /* Secondary text */
  --colour-text-light:    #f0ebe2; /* Primary body text on dark backgrounds */
  --colour-text-muted:    #9b8b78; /* Captions, metadata, muted text */

  /* --- Colour: Status (expedition states) --- */
  --colour-status-done:   #4a7c59; /* Completed — green */
  --colour-status-next:   #E35205; /* Upcoming — orange */
  --colour-status-plan:   #6b7280; /* Planned — slate */
  --colour-status-tbc:    #9b8b78; /* TBC — muted */

  /* --- Typography: Font Families --- */
  --font-mono:   'Space Mono', 'JetBrains Mono', 'Courier Prime', 'IBM Plex Mono', monospace;
  --font-serif:  'Raleway', Georgia, 'Times New Roman', sans-serif; /* Display headings */
  --font-body:   'Space Mono', monospace; /* All body text stays monospace */

  /* --- Typography: Scale (fluid using clamp) --- */
  --text-xs:     clamp(0.65rem,  0.6rem  + 0.25vw, 0.75rem);
  --text-sm:     clamp(0.75rem,  0.7rem  + 0.3vw,  0.875rem);
  --text-base:   clamp(0.875rem, 0.8rem  + 0.4vw,  1rem);
  --text-md:     clamp(1rem,     0.9rem  + 0.5vw,  1.125rem);
  --text-lg:     clamp(1.125rem, 1rem    + 0.6vw,  1.375rem);
  --text-xl:     clamp(1.375rem, 1.2rem  + 0.9vw,  1.75rem);
  --text-2xl:    clamp(1.75rem,  1.5rem  + 1.25vw, 2.5rem);
  --text-3xl:    clamp(2.25rem,  1.8rem  + 2.25vw, 3.5rem);
  --text-hero:   clamp(2.75rem,  2rem    + 3.5vw,  5rem);

  /* --- Typography: Line Heights --- */
  --leading-tight:  1.2;
  --leading-snug:   1.4;
  --leading-normal: 1.6;
  --leading-loose:  1.8;

  /* --- Typography: Letter Spacing --- */
  --tracking-tight:  -0.02em;
  --tracking-normal: 0em;
  --tracking-wide:   0.05em;
  --tracking-wider:  0.1em;
  --tracking-widest: 0.2em;

  /* --- Spacing Scale --- */
  --space-1:   0.25rem;   /*  4px */
  --space-2:   0.5rem;    /*  8px */
  --space-3:   0.75rem;   /* 12px */
  --space-4:   1rem;      /* 16px */
  --space-5:   1.25rem;   /* 20px */
  --space-6:   1.5rem;    /* 24px */
  --space-8:   2rem;      /* 32px */
  --space-10:  2.5rem;    /* 40px */
  --space-12:  3rem;      /* 48px */
  --space-16:  4rem;      /* 64px */
  --space-20:  5rem;      /* 80px */
  --space-24:  6rem;      /* 96px */
  --space-32:  8rem;      /* 128px */

  /* --- Layout --- */
  --max-width:        1200px;
  --max-width-narrow: 800px;
  --max-width-wide:   1400px;
  --nav-height:       64px;
  --banner-height:    40px;

  /* --- Borders & Radius --- */
  --radius-sm:    3px;
  --radius-md:    6px;
  --radius-lg:    12px;
  --border-width: 1px;
  --border-colour: var(--colour-light-3);

  /* --- Shadows --- */
  --shadow-sm:  0 1px 3px rgba(26, 21, 16, 0.12);
  --shadow-md:  0 4px 12px rgba(26, 21, 16, 0.15);
  --shadow-lg:  0 8px 32px rgba(26, 21, 16, 0.2);
  --shadow-xl:  0 16px 48px rgba(26, 21, 16, 0.25);

  /* --- Transitions --- */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* --- Z-index Scale --- */
  --z-below:    -1;
  --z-base:     0;
  --z-raised:   10;
  --z-overlay:  100;
  --z-nav:      200;
  --z-modal:    300;
}


/* ==========================================================================
   2. CSS RESET & BASE
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--colour-text-dark);
  background-color: var(--colour-light-1);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

ul[class],
ol[class] {
  list-style: none;
}

nav ul,
nav ol {
  list-style: none;
}

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

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

button {
  background: none;
  border: none;
  cursor: pointer;
}

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

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

::selection {
  background-color: var(--colour-orange);
  color: var(--colour-light-1);
}


/* ==========================================================================
   3. GRAIN / TEXTURE OVERLAY
   Performance-friendly CSS noise — SVG filter, no raster image
   ========================================================================== */

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: var(--z-overlay);
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}


/* ==========================================================================
   4. TYPOGRAPHY — Global Hierarchy
   ========================================================================== */

.text-display {
  font-family: var(--font-serif);
  font-size: var(--text-hero);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 700;
}

h1,
.h1 {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 700;
}

h2,
.h2 {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  font-weight: 700;
}

h3,
.h3 {
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-normal);
  font-weight: 700;
}

h4,
.h4 {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  font-weight: 700;
}

h5,
.h5 {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  font-weight: 700;
}

h6,
.h6 {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

p {
  font-size: var(--text-base);
  line-height: var(--leading-loose);
  color: var(--colour-text-mid);
}

.text-lead {
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--colour-text-mid);
}

.text-sm,
small {
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}

.text-xs,
.caption {
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

.label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--colour-text-muted);
}

/* Orange left-border heading accent */
.heading-ruled {
  padding-left: var(--space-4);
  border-left: 3px solid var(--colour-orange);
}

/* Eyebrow label — sits above headings */
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--colour-orange);
  margin-bottom: var(--space-3);
}

.text-accent {
  color: var(--colour-orange);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background-color: var(--colour-light-2);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
  color: var(--colour-tawny);
}


/* ==========================================================================
   5. LAYOUT UTILITIES
   ========================================================================== */

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

/* Increase breathing room at widths where the container fills the viewport */
@media (min-width: 1024px) and (max-width: 1279px) {
  .container {
    padding-inline: var(--space-10);
  }
}

.container--narrow {
  max-width: var(--max-width-narrow);
}

.container--wide {
  max-width: var(--max-width-wide);
}

.section {
  padding-block: var(--space-20);
}

.section--sm {
  padding-block: var(--space-12);
}

.section--lg {
  padding-block: var(--space-32);
}

.section--dark {
  background-color: var(--colour-dark-1);
  color: var(--colour-text-light);
}

.section--dark p {
  color: var(--colour-text-light);
  opacity: 0.85;
}

.section--mid {
  background-color: var(--colour-dark-2);
  color: var(--colour-text-light);
}

.section--warm {
  background-color: var(--colour-light-2);
}

.section-header {
  margin-bottom: var(--space-12);
}

.section-header--center {
  text-align: center;
}

/* Grid */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* Flex */
.flex { display: flex; }
.flex--center { align-items: center; justify-content: center; }
.flex--between { align-items: center; justify-content: space-between; }
.flex--gap { gap: var(--space-4); }

@media (max-width: 768px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}


/* ==========================================================================
   6. LINKS
   ========================================================================== */

.prose a,
.link {
  color: var(--colour-orange);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-fast);
}

.prose a:hover,
.link:hover {
  color: var(--colour-orange-dark);
}

.link--subtle {
  color: var(--colour-text-mid);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.link--subtle:hover {
  color: var(--colour-orange);
}


/* ==========================================================================
   7. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--transition-base),
    color var(--transition-base),
    border-color var(--transition-base),
    transform var(--transition-fast),
    box-shadow var(--transition-base);
  min-height: 44px;
  min-width: 44px;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

/* Primary — orange fill */
.btn--primary {
  background-color: var(--colour-orange);
  color: #fff;
  border-color: var(--colour-orange);
}

.btn--primary:hover {
  background-color: var(--colour-orange-dark);
  border-color: var(--colour-orange-dark);
  box-shadow: 0 4px 16px rgba(227, 82, 5, 0.35);
}

/* Secondary — outline orange */
.btn--secondary {
  background-color: transparent;
  color: var(--colour-orange);
  border-color: var(--colour-orange);
}

.btn--secondary:hover {
  background-color: var(--colour-orange);
  color: #fff;
}

/* Ghost — for dark backgrounds */
.btn--ghost {
  background-color: transparent;
  color: var(--colour-text-light);
  border-color: rgba(240, 235, 226, 0.4);
}

.btn--ghost:hover {
  background-color: rgba(240, 235, 226, 0.1);
  border-color: var(--colour-text-light);
}

/* Large variant */
.btn--lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-md);
  min-height: 52px;
}

/* Icon-only */
.btn--icon {
  padding: var(--space-3);
  min-width: 44px;
  width: 44px;
  height: 44px;
}


/* ==========================================================================
   8. DIVIDERS & DECORATIVE ELEMENTS
   ========================================================================== */

hr,
.divider {
  border: none;
  border-top: 1px solid var(--colour-light-3);
  margin-block: var(--space-8);
}

.divider--dark {
  border-top-color: rgba(240, 235, 226, 0.1);
}

/* Orange accent rule */
.rule-orange {
  display: block;
  width: 48px;
  height: 3px;
  background-color: var(--colour-orange);
  margin-bottom: var(--space-6);
}

.rule-orange--center {
  margin-inline: auto;
}

/* Tags / badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-sm);
  background-color: var(--colour-light-2);
  color: var(--colour-text-mid);
  border: 1px solid var(--colour-light-3);
}

.tag--orange {
  background-color: rgba(227, 82, 5, 0.1);
  color: var(--colour-orange);
  border-color: rgba(227, 82, 5, 0.25);
}

.tag--dark {
  background-color: rgba(240, 235, 226, 0.1);
  color: var(--colour-text-light);
  border-color: rgba(240, 235, 226, 0.2);
}


/* ==========================================================================
   9. STATUS INDICATORS
   ========================================================================== */

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status--completed { color: var(--colour-status-done); }
.status--completed::before { background-color: var(--colour-status-done); }

.status--upcoming { color: var(--colour-status-next); }
.status--upcoming::before {
  background-color: var(--colour-status-next);
  box-shadow: 0 0 6px rgba(227, 82, 5, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

.status--planned { color: var(--colour-status-plan); }
.status--planned::before { background-color: var(--colour-status-plan); }

.status--tbc { color: var(--colour-status-tbc); }
.status--tbc::before { background-color: var(--colour-status-tbc); opacity: 0.5; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(227, 82, 5, 0.5); }
  50%       { box-shadow: 0 0 10px rgba(227, 82, 5, 0.9); }
}


/* ==========================================================================
   10. IMAGES & MEDIA
   ========================================================================== */

.img-wrap {
  overflow: hidden;
  position: relative;
}

.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-wrap--16-9 { aspect-ratio: 16 / 9; }
.img-wrap--4-3  { aspect-ratio: 4 / 3; }
.img-wrap--3-2  { aspect-ratio: 3 / 2; }
.img-wrap--1-1  { aspect-ratio: 1 / 1; }
.img-wrap--hero { aspect-ratio: 21 / 9; }

/* Placeholder slot — styled hatching until real image is dropped in */
.img-placeholder {
  background-color: var(--colour-dark-3);
  background-image: linear-gradient(
    135deg,
    var(--colour-dark-3) 25%,
    var(--colour-dark-2) 25%,
    var(--colour-dark-2) 50%,
    var(--colour-dark-3) 50%,
    var(--colour-dark-3) 75%,
    var(--colour-dark-2) 75%
  );
  background-size: 20px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--colour-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}


/* ==========================================================================
   11. FOOTER
   ========================================================================== */

.footer {
  background-color: var(--colour-dark-1);
  color: var(--colour-text-light);
  padding-block: var(--space-16) var(--space-8);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.footer__logo {
  display: block;
  margin-bottom: var(--space-4);
  max-width: 160px;
}

.footer__tagline {
  font-size: var(--text-sm);
  color: rgba(240, 235, 226, 0.6);
  margin-bottom: var(--space-6);
  font-style: italic;
}

.footer__ms-society {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-6);
  font-size: var(--text-xs);
  color: rgba(240, 235, 226, 0.5);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.footer__ms-logo {
  min-width: 160px;
  max-width: 160px;
  opacity: 0.7;
  flex-shrink: 0;
}

.footer__ms-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: var(--leading-normal);
}

.footer__heading {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--colour-orange);
  margin-bottom: var(--space-4);
}

.footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__links a {
  font-size: var(--text-sm);
  color: rgba(240, 235, 226, 0.65);
  transition: color var(--transition-fast);
}

.footer__links a:hover {
  color: var(--colour-orange);
}

.footer__bottom {
  border-top: 1px solid rgba(240, 235, 226, 0.08);
  padding-top: var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer__legal {
  font-size: var(--text-xs);
  color: rgba(240, 235, 226, 0.35);
  letter-spacing: var(--tracking-wide);
}

.footer__social {
  display: flex;
  gap: var(--space-4);
}

.footer__social a {
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: rgba(240, 235, 226, 0.5);
  transition: color var(--transition-fast);
}

.footer__social a:hover {
  color: var(--colour-orange);
}

@media (max-width: 768px) {
  .footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: var(--space-6);
  }

  .footer__bottom {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .footer__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer__logo {
    margin-inline: auto;
  }

  .footer__links {
    align-items: center;
  }

  .footer__ms-society {
    justify-content: center;
    flex-direction: column;
    align-items: center;
  }
}


/* ==========================================================================
   12. ACCESSIBILITY & UTILITY
   ========================================================================== */

/* Scroll margin clears sticky nav on anchor jumps */
[id] {
  scroll-margin-top: calc(var(--nav-height) + var(--space-4));
}

/* Visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip to content link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  background-color: var(--colour-orange);
  color: #fff;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--radius-md);
  z-index: calc(var(--z-nav) + 10);
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Fade-in reveal — paired with IntersectionObserver in main.js */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

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

.no-js .fade-in {
  opacity: 1;
  transform: none;
}


/* ==========================================================================
   13. PRINT
   ========================================================================== */

@media print {
  body::before { display: none; }
  .nav,
  .footer__social,
  .btn { display: none; }
  body {
    background: #fff;
    color: #000;
  }
}
