/* =========================================================
   EPRO506 Assessment 3 - Digital Portfolio
   Working with Children, Families and Communities
   ========================================================= */

:root {
  /* Ink and paper */
  --ink: #171a17;
  --ink-soft: #45483f;
  --ink-muted: #797c72;
  --paper: #fbf8f1;
  --paper-warm: #f2ebd8;
  --sand: #e7dcc0;
  --sand-dark: #c6b995;
  --line: #d9cfb4;

  /* Tab accents */
  --c-economic: #a6763c;
  --c-social: #5d8161;
  --c-cultural: #8a4a34;
  --c-health: #6f5f8b;
  --c-crisis: #b0533b;
  --tab-accent: var(--ink);
  --tab-tint: #f4efe1;

  /* Type */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Scale */
  --step-0: 1.02rem;
  --step-1: 1.15rem;
  --step-2: 1.4rem;
  --step-3: 1.8rem;
  --step-4: 2.4rem;
  --step-5: 3.2rem;
  --step-6: 4.2rem;

  /* Layout */
  --header-h: 72px;
  --content-max: 900px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--line); }
a:hover { color: var(--tab-accent); text-decoration-color: var(--tab-accent); text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--tab-accent); outline-offset: 3px; border-radius: 2px; }

/* ---------- Header ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.1);
}
.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: var(--header-h);
}
.brand {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  line-height: 1.15;
  color: var(--ink);
  flex-shrink: 0;
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.brand-title em { font-style: italic; color: var(--tab-accent); }
.brand-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  margin-top: 2px;
}

.nav {
  margin-left: auto;
  display: flex;
  gap: 0.15rem;
  align-items: center;
  list-style: none;
  padding: 0;
}
.nav a {
  display: block;
  padding: 0.55rem 0.85rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 4px;
  border-bottom: 2px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a.active {
  color: var(--ink);
  border-bottom-color: var(--tab-accent);
  font-weight: 500;
}
.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 0.4rem;
  align-self: center;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0.5rem 0.9rem;
  border-radius: 4px;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--ink-soft); }

/* ---------- Hero banner ---------- */
.hero-banner {
  width: 100%;
  height: 260px;
  overflow: hidden;
  position: relative;
  background: var(--paper-warm);
}
.hero-banner img, .hero-banner svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(251, 248, 241, 0) 60%, rgba(251, 248, 241, 0.9) 100%);
  pointer-events: none;
}

.hero {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 2rem;
}
.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--tab-accent);
  margin: 0 0 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
}
.eyebrow::before {
  content: '';
  width: 28px;
  height: 2px;
  background: var(--tab-accent);
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, var(--step-5));
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 1.2rem;
  color: var(--ink);
}
.hero h1 em { font-style: italic; color: var(--tab-accent); }
.lede {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0;
  max-width: 42em;
}

/* ---------- Content ---------- */
.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1rem 1.5rem 5rem;
}

.content h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 3.5rem 0 1rem;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}
.content h2 .h2-num {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tab-accent);
  background: var(--tab-tint);
  padding: 0.28rem 0.55rem;
  border-radius: 3px;
  letter-spacing: 0.06em;
  position: relative;
  top: -3px;
}

.content h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-2);
  line-height: 1.3;
  margin: 2.5rem 0 0.8rem;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}
.content h3 .count {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--tab-tint);
  color: var(--tab-accent);
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  position: relative;
  top: -2px;
}

.content p {
  margin: 0 0 1.2rem;
  color: var(--ink-soft);
}
.content p strong { color: var(--ink); font-weight: 600; }

/* ---------- Statistic callout ---------- */
.stat-callout {
  background: var(--tab-tint);
  border-left: 4px solid var(--tab-accent);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
  border-radius: 0 6px 6px 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1.5rem;
  align-items: center;
}
.stat-number {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 3rem;
  line-height: 1;
  color: var(--tab-accent);
  letter-spacing: -0.02em;
}
.stat-label {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.stat-source {
  grid-column: 2;
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- Strategies (ordered list) ---------- */
.strategies {
  list-style: none;
  counter-reset: strat;
  padding: 0;
  margin: 1.5rem 0 2rem;
  display: grid;
  gap: 0.8rem;
}
.strategies li {
  counter-increment: strat;
  padding: 1.15rem 1.4rem 1.15rem 3.6rem;
  background: var(--paper-warm);
  border-radius: 6px;
  position: relative;
  color: var(--ink-soft);
  border-left: 3px solid var(--tab-accent);
}
.strategies li::before {
  content: counter(strat, decimal-leading-zero);
  position: absolute;
  left: 1.2rem;
  top: 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tab-accent);
  letter-spacing: 0.03em;
}
.strategies li strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Tables ---------- */
.table-wrap {
  margin: 1.2rem 0 2rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  min-width: 500px;
}
.content table th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: white;
  background: var(--tab-accent);
  border-bottom: 1px solid var(--line);
}
.content table td {
  padding: 0.9rem 1rem;
  vertical-align: top;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  line-height: 1.55;
}
.content table tr:last-child td { border-bottom: none; }
.content table tr:nth-child(even) td { background: var(--paper-warm); }
.content table td a {
  color: var(--tab-accent);
  text-decoration-color: var(--tab-accent);
  word-break: break-word;
}
.content table td:first-child {
  font-weight: 500;
  color: var(--ink);
}

.resource-block {
  margin-bottom: 1rem;
}

/* ---------- Home page context cards ---------- */
.context-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 2.5rem 0 3rem;
}
.context-card {
  background: white;
  padding: 1.75rem 1.9rem;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--card-accent, var(--tab-accent));
  border-radius: 4px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 1.5rem;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.context-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px -8px rgba(23, 26, 23, 0.15);
}
.context-card .num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--card-accent, var(--ink-muted));
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  padding-top: 0.15rem;
}
.context-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 0 0 0.55rem;
  color: var(--ink);
  display: block;
}
.context-card p {
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}
.context-card .arrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--card-accent, var(--tab-accent));
  font-weight: 600;
}

/* ---------- Page-nav (prev/next) ---------- */
.page-nav {
  margin-top: 4rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  font-size: 0.95rem;
}
.page-nav a {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 45%;
}
.page-nav .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-muted);
  font-weight: 600;
}
.page-nav .next { text-align: right; margin-left: auto; }
.page-nav a:hover { color: var(--tab-accent); }

/* ---------- References page specific ---------- */
.reflist {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  counter-reset: ref;
}
.reflist li {
  counter-increment: ref;
  padding: 0.75rem 0 0.75rem 3.2rem;
  border-bottom: 1px solid var(--line);
  position: relative;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.reflist li:last-child { border-bottom: none; }
.reflist li::before {
  content: counter(ref);
  position: absolute;
  left: 0;
  top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
  width: 2.4rem;
  text-align: right;
}
.reflist li a {
  color: var(--tab-accent);
  word-break: break-word;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--ink-muted);
  font-size: 0.85rem;
  background: var(--paper-warm);
}
.site-footer strong { color: var(--ink); font-weight: 600; }

/* ---------- Responsive ---------- */
@media (min-width: 700px) {
  .context-grid { grid-template-columns: 1fr 1fr; }
  .context-grid .context-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Default (desktop): show long brand title */
.brand-title-full { display: inline; }
.brand-title-short { display: none; }

@media (max-width: 900px) {
  .header-inner { padding: 0 1rem; gap: 0.75rem; position: relative; }
  .brand { flex-shrink: 1; min-width: 0; }
  .brand-title { font-size: 0.95rem; }
  .brand-title-full { display: none; }
  .brand-title-short { display: inline; }
  .brand-tag { font-size: 0.68rem; letter-spacing: 0.12em; }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem;
    gap: 0;
    box-shadow: 0 8px 20px -12px rgba(0,0,0,0.15);
    z-index: 30;
  }
  .nav.open { display: flex; }
  .nav a {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    font-size: 0.95rem;
  }
  .nav a:last-child { border-bottom: none; }
  .nav a.active { border-left: 3px solid var(--tab-accent); border-bottom: 1px solid var(--line); padding-left: 0.85rem; }
  .nav-divider { display: none; }
  .nav-toggle { display: inline-block; margin-left: auto; flex-shrink: 0; }
  .hero-banner { height: 160px; }
  .stat-callout { grid-template-columns: 1fr; gap: 0.4rem 0; padding: 1.25rem; }
  .stat-source { grid-column: 1; }
  .stat-number { font-size: 2.4rem; }
  .content table th, .content table td { padding: 0.7rem 0.8rem; font-size: 0.9rem; }
  .strategies li { padding: 1rem 1.1rem 1rem 3.2rem; }
  .content h2 { font-size: 1.6rem; margin-top: 2.5rem; }
}

/* ---------- Print ---------- */
@media print {
  .header, .nav-toggle, .page-nav, .hero-banner { display: none; }
  .content { max-width: none; }
  a { text-decoration: none; color: var(--ink); }
  .stat-callout, .strategies li { break-inside: avoid; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
