/* ==========================================================================
   The Island Exchange — Website CSS
   Mobile-first, no frameworks, matches the document palette.
   ========================================================================== */

:root {
  --primary: #1F3A5F;       /* Navy */
  --accent: #B08D57;        /* Brass */
  --soft: #F2EDE4;          /* Cream */
  --muted: #6B6B6B;         /* Grey */
  --plan-tint: #E8F0F5;     /* Audience tints */
  --gov-tint: #EAF0E5;
  --com-tint: #FFF4E5;
  --bg: #FBF9F4;            /* Off-white page background */
  --text: #2A2A2A;          /* Body text */
  --line: #DCD6CA;          /* Divider lines */

  --serif: "Georgia", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --max-width: 720px;
  --gutter: 1.25rem;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 17px;          /* Slightly larger base for mobile readability */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(176, 141, 87, 0.2);  /* Subtle brass tap flash */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  font-feature-settings: "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Better touch targets for any tappable element on mobile */
@media (hover: none) and (pointer: coarse) {
  a, button, .btn { min-height: 44px; }
  nav.primary a { padding: 0.95rem 0; }    /* ~46px tall */
  nav.menu-toggle { padding: 0.6rem 0.9rem; min-height: 44px; min-width: 44px; }
  .dl .links a { padding: 0.4rem 0; display: inline-block; }
}

/* ==========================================================================
   Layout
   ========================================================================== */

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

main {
  padding: 1.5rem 0 4rem;
}

section {
  padding: 2.5rem 0;
  border-bottom: 1px solid var(--line);
}

section:last-child {
  border-bottom: none;
}

/* ==========================================================================
   Header / nav
   ========================================================================== */

header.site {
  background: var(--primary);
  color: white;
  padding: 1rem var(--gutter);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

header.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

header.site .brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: white;
}

header.site .brand .at {
  color: var(--accent);
  font-weight: 400;
  font-style: italic;
  margin-left: 0.4em;
}

nav.menu-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  font: inherit;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

nav.primary {
  display: none;
  background: var(--primary);
  border-top: 1px solid rgba(255,255,255,0.15);
  padding: 0.5rem var(--gutter);
}

nav.primary.open {
  display: block;
}

nav.primary ul {
  max-width: var(--max-width);
  margin: 0 auto;
  list-style: none;
  padding: 0;
}

nav.primary li {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

nav.primary li:last-child {
  border-bottom: none;
}

nav.primary a {
  color: white;
  text-decoration: none;
  display: block;
  padding: 0.85rem 0;
  font-size: 1rem;
}

nav.primary a:hover, nav.primary a.current {
  color: var(--accent);
}

@media (min-width: 760px) {
  nav.menu-toggle { display: none; }
  nav.primary { display: block; background: transparent; border-top: none; padding: 0; }
  nav.primary ul { display: flex; gap: 1.5rem; align-items: center; }
  nav.primary li { border-bottom: none; }
  nav.primary a { padding: 0.2rem 0; font-size: 0.95rem; }
  header.site .inner { gap: 2rem; }
}

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

.hero {
  padding: 0;
  border-bottom: none;
}

.hero-image {
  width: 100%;
  height: 45vh;
  min-height: 240px;
  max-height: 480px;
  background-image: url("../svg/05_site_aerial.jpg");
  background-size: cover;
  background-position: center 40%;     /* Bias toward upper portion of image */
  background-color: var(--primary);
}

.hero-text {
  padding: 2rem var(--gutter) 1.25rem;
  text-align: center;
}

.hero-text h1 {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.85rem;        /* Slightly smaller default for mobile */
  color: var(--primary);
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.hero-text .at {
  font-style: italic;
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
}

.hero-text .tagline {
  font-style: italic;
  color: var(--primary);
  font-size: 1.05rem;
  line-height: 1.45;
  max-width: 28em;
  margin: 1rem auto 0;
  padding: 0.85rem 0;
  border-top: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
}

@media (min-width: 540px) {
  .hero-image { height: 50vh; }
  .hero-text h1 { font-size: 2.4rem; }
  .hero-text .tagline { font-size: 1.15rem; }
}

@media (min-width: 760px) {
  .hero-text h1 { font-size: 3rem; }
  .hero-text .tagline { font-size: 1.25rem; }
}

/* ==========================================================================
   Opening prose ("the wall")
   ========================================================================== */

.opening {
  background: var(--bg);
  padding: 3rem var(--gutter);
  text-align: center;
}

.opening p {
  font-style: italic;
  color: var(--primary);
  line-height: 1.7;
  font-size: 1.05rem;
  max-width: 32em;
  margin: 0 auto 1.5rem;
}

.opening p:first-child {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 1.75rem;
}

.opening hr {
  width: 80%;
  max-width: 24em;
  border: 0;
  border-top: 1px solid var(--accent);
  margin: 2rem auto;
}

.opening .closer {
  color: var(--accent);
  font-style: italic;
}

/* ==========================================================================
   Lineage
   ========================================================================== */

.lineage {
  background: var(--soft);
  padding: 2.5rem var(--gutter);
  text-align: center;
}

.lineage h2 {
  font-family: var(--sans);
  color: var(--primary);
  font-size: 1.6rem;
  margin: 0 0 1.5rem;
}

.lineage p {
  max-width: 38em;
  margin: 0 auto 1.25rem;
  line-height: 1.65;
}

.epigraph {
  margin: 2rem auto 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--accent);
  max-width: 36em;
}

.epigraph .fr {
  font-style: italic;
  color: var(--accent);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.epigraph .en {
  font-style: italic;
  color: var(--primary);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.epigraph .src {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ==========================================================================
   Headings & body
   ========================================================================== */

h1, h2, h3, h4 {
  font-family: var(--sans);
  color: var(--primary);
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: 1.85rem;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 1.15rem;
  color: var(--accent);
  margin: 1.5rem 0 0.5rem;
  font-weight: 600;
}

h4 {
  font-size: 1rem;
  margin: 1.25rem 0 0.4rem;
}

p {
  margin: 0 0 1rem;
}

ul, ol {
  padding-left: 1.5rem;
  margin: 0 0 1.25rem;
}

li {
  margin-bottom: 0.6rem;
  line-height: 1.55;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

@media (min-width: 760px) {
  h1 { font-size: 2.4rem; }
  h2 { font-size: 1.85rem; }
  h3 { font-size: 1.3rem; }
}

/* ==========================================================================
   Section header (eyebrow + heading + lead)
   ========================================================================== */

.section-head {
  text-align: center;
  margin-bottom: 2rem;
}

.section-head .eyebrow {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.section-head h2 {
  margin: 0 0 0.5rem;
}

.section-head .lead {
  color: var(--muted);
  font-style: italic;
  font-size: 1rem;
  max-width: 36em;
  margin: 0.5rem auto 0;
}

/* ==========================================================================
   Numbers / stats grid
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}

.stat {
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
}

.stat .value {
  display: block;
  color: var(--primary);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 0.25rem;
}

.stat .label {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

@media (min-width: 600px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}

/* ==========================================================================
   Two-language box (the funder/community framing)
   ========================================================================== */

.two-lang {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

.two-lang .panel {
  background: white;
  border-left: 4px solid var(--accent);
  padding: 1.25rem 1.25rem 1rem;
  border-radius: 0 4px 4px 0;
}

.two-lang .panel.community { border-left-color: var(--accent); }
.two-lang .panel.funder { border-left-color: var(--primary); }

.two-lang h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.two-lang .name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.two-lang p { margin-bottom: 0; font-size: 0.95rem; }

@media (min-width: 720px) {
  .two-lang { grid-template-columns: 1fr 1fr; gap: 1.5rem; }
}

/* ==========================================================================
   Callout boxes
   ========================================================================== */

.callout {
  background: var(--soft);
  border-left: 4px solid var(--accent);
  padding: 1.25rem;
  margin: 2rem 0;
  border-radius: 0 4px 4px 0;
}

.callout h4 {
  margin: 0 0 0.5rem;
  color: var(--primary);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout.signal {
  border-left-color: var(--primary);
  background: var(--plan-tint);
}

.callout.community-feedback {
  border-left-color: var(--accent);
  background: var(--com-tint);
}

/* ==========================================================================
   Diagram cards (architectural SVGs)
   ========================================================================== */

.diagram {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem;
  margin: 1.5rem 0;
  overflow: hidden;
  position: relative;
}

.diagram svg, .diagram img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
}

.diagram .zoom-hint {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(31, 58, 95, 0.85);
  color: white;
  font-size: 0.7rem;
  padding: 0.3rem 0.55rem;
  border-radius: 3px;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.diagram .caption {
  margin: 0.75rem 0 0;
  font-style: italic;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: center;
}

.diagram-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

/* Lightbox overlay for zoomed diagrams */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 200;
  padding: 0.5rem;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  overflow: auto;
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  background: white;
  border-radius: 4px;
}

.lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  width: 44px;
  height: 44px;
  border-radius: 22px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 201;
}

/* ==========================================================================
   Team cards
   ========================================================================== */

.team {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

.team .person {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem;
}

.team .person .role {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.team .person h3 {
  font-size: 1.15rem;
  color: var(--primary);
  margin: 0 0 0.6rem;
}

.team .person p {
  font-size: 0.9rem;
  margin-bottom: 0.6rem;
  line-height: 1.55;
}

.team .person p:last-child { margin-bottom: 0; }

@media (min-width: 720px) {
  .team.cols-2 { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Tables / cards (responsive)
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
}

table th, table td {
  text-align: left;
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  vertical-align: top;
}

table th {
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

@media (max-width: 559px) {
  /* On mobile, tables become stacked cards */
  table.responsive thead { display: none; }
  table.responsive tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 4px;
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: white;
  }
  table.responsive td {
    display: block;
    border: none;
    padding: 0.4rem 0;
    font-size: 0.95rem;
  }
  table.responsive td:before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.15rem;
  }
}

/* ==========================================================================
   Asks / ask blocks
   ========================================================================== */

.asks {
  margin: 1.5rem 0;
  display: grid;
  gap: 1rem;
}

.asks .ask {
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 1.25rem;
}

.asks .ask .num {
  display: inline-block;
  width: 1.6rem;
  height: 1.6rem;
  line-height: 1.6rem;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  text-align: center;
  font-weight: 700;
  margin-right: 0.6rem;
  font-size: 0.85rem;
  vertical-align: middle;
}

.asks .ask h3 {
  display: inline;
  color: var(--primary);
  font-size: 1.1rem;
  margin: 0;
}

.asks .ask p {
  margin: 0.6rem 0 0;
  font-size: 0.95rem;
}

/* ==========================================================================
   CTA / button
   ========================================================================== */

.cta-row {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.btn {
  display: block;
  text-align: center;
  background: var(--primary);
  color: white;
  text-decoration: none;
  padding: 0.95rem 1.25rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease;
}

.btn:hover {
  background: #163050;
  color: white;
}

.btn.secondary {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn.secondary:hover {
  background: var(--soft);
  color: var(--primary);
}

.btn.accent {
  background: var(--accent);
}

.btn.accent:hover {
  background: #997844;
  color: white;
}

@media (min-width: 600px) {
  .cta-row { grid-template-columns: 1fr 1fr; }
}

/* ==========================================================================
   Downloads grid
   ========================================================================== */

.downloads {
  display: grid;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.dl {
  background: white;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.dl .icon {
  font-size: 1.5rem;
  color: var(--accent);
  flex-shrink: 0;
}

.dl .body { flex: 1; }

.dl h4 {
  margin: 0 0 0.25rem;
  color: var(--primary);
  font-size: 1rem;
}

.dl p {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.dl .links {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.dl .links a {
  color: var(--accent);
  font-weight: 600;
}

@media (min-width: 600px) {
  .downloads { grid-template-columns: 1fr 1fr; }
}

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

footer.site {
  background: var(--primary);
  color: rgba(255,255,255,0.85);
  padding: 2.5rem var(--gutter) 1.5rem;
  margin-top: 3rem;
}

footer.site .inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

footer.site .authors {
  font-style: italic;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

footer.site p {
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}

footer.site .meta {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
}

/* ==========================================================================
   Password gate
   ========================================================================== */

.gate {
  position: fixed;
  inset: 0;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  z-index: 1000;
}

.gate.hidden { display: none; }

.gate-inner {
  max-width: 30em;
  text-align: center;
}

.gate h1 {
  color: white;
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.gate p {
  color: rgba(255,255,255,0.85);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  font-style: italic;
}

.gate input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: white;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.gate input::placeholder { color: rgba(255,255,255,0.5); }

.gate button {
  width: 100%;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 600;
  padding: 0.85rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.gate .err {
  color: #ff9b9b;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

.gate .note {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
  font-style: italic;
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  header.site, footer.site, nav.primary { display: none; }
  body { background: white; }
  section { padding: 1rem 0; break-inside: avoid; }
}
