/* ===========================================================================
   Global South European Maritime Hub
   Design system — scholarly maritime publication aesthetic
   =========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500;9..144,600;9..144,700;9..144,900&family=Source+Serif+4:opsz,wght@8..60,300;8..60,400;8..60,500;8..60,600&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Colour system — port authority publication palette */
  --ink:           #14181E;
  --ink-soft:      #2B3138;
  --slate:         #5C6670;
  --slate-light:   #8A8F96;
  --rule:          #D4CFC0;
  --rule-soft:     #E8E3D6;
  --paper:         #FAF8F4;
  --paper-tint:    #F2EDE1;
  --navy:          #0A2540;
  --navy-deep:     #061A30;
  --brass:         #B8860B;
  --brass-bright:  #D4A017;
  --sea:           #1B4D6B;
  --kelp:          #2D5238;

  /* Typography */
  --font-display:  'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:     'Source Serif 4', Georgia, serif;
  --font-mono:     'JetBrains Mono', 'Courier New', monospace;

  /* Scale */
  --measure:       78ch;
  --gutter:        clamp(1.25rem, 3vw, 2.5rem);
  --pagespace:     clamp(1.5rem, 5vw, 4rem);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 var(--pagespace);
}

.measure { max-width: var(--measure); }
.measure-wide { max-width: 88ch; }

main {
  padding: clamp(2rem, 5vw, 4rem) 0 6rem;
}

/* ===========================================================================
   Masthead — like a publication's nameplate
   =========================================================================== */

.masthead {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 1.5rem 0 1rem;
}

.masthead-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.masthead-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate);
}

.masthead-meta span:nth-child(2) {
  color: var(--brass);
}

.masthead-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--navy-deep);
  font-variation-settings: "opsz" 144;
}

.masthead-title a {
  color: inherit;
  text-decoration: none;
}

.masthead-tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--slate);
  letter-spacing: 0.01em;
}

/* Navigation strip */
.nav-strip {
  border-top: 2px solid var(--navy-deep);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 10;
}

.nav-strip-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.85rem 0;
}

.nav-strip a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s;
  position: relative;
}

.nav-strip a:hover, .nav-strip a[aria-current="page"] {
  color: var(--brass);
}

.nav-strip a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -0.85rem;
  height: 2px;
  background: var(--brass);
}

/* ===========================================================================
   Typography — editorial hierarchy
   =========================================================================== */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy-deep);
  font-weight: 500;
  font-variation-settings: "opsz" 144;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 500;
  margin-bottom: 1rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 500;
  margin: 3.5rem 0 1.25rem;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.25;
  font-weight: 600;
  margin: 2.25rem 0 0.75rem;
  letter-spacing: -0.005em;
}

h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--ink-soft);
}

p {
  margin-bottom: 1.15rem;
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Body content elements all center within their parent for balanced layout */
main h2,
main h3,
main h4,
main ul,
main ol,
main dl,
main .pull,
main .aside-card,
main .data-table,
main table,
main .toc,
main .article-nav,
main .breadcrumb,
main .eyebrow,
main section > p {
  margin-left: auto;
  margin-right: auto;
  max-width: var(--measure);
}

main .data-table,
main table {
  max-width: var(--measure);
}

/* Lead paragraph keeps drop cap working but also centers */
main .lead,
article .lead {
  margin-left: auto;
  margin-right: auto;
  text-align: left; /* Lead with drop cap shouldn't be justified */
}

/* Article header content centers too */
.article-header {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

/* Hero section content centers */
.hero {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

/* Don't justify in cards or asides where width is constrained anyway */
.aside-card p,
.pull p {
  text-align: left;
}

a {
  color: var(--sea);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 0.15s, color 0.15s;
}

a:hover {
  color: var(--brass);
  text-decoration-color: var(--brass);
}

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }
small { font-size: 0.85em; color: var(--slate); }

/* Drop cap for lead paragraphs */
.lead {
  font-size: 1.18rem;
  line-height: 1.55;
  color: var(--ink-soft);
  font-weight: 400;
}

.lead::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 4.2rem;
  float: left;
  line-height: 0.85;
  padding: 0.32rem 0.5rem 0 0;
  color: var(--brass);
  font-variation-settings: "opsz" 144;
}

/* Eyebrow / section label */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brass);
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--brass);
}

/* Article header for handbook pages */
.article-header {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate);
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
}

.article-meta span::before {
  content: "//";
  color: var(--brass);
  margin-right: 0.5rem;
  font-weight: 700;
}

/* Lists */
ul, ol {
  margin: 0 0 1.25rem 1.4rem;
  max-width: var(--measure);
}

li { margin-bottom: 0.4rem; line-height: 1.6; }

ul li::marker { color: var(--brass); }
ol li::marker { color: var(--brass); font-family: var(--font-mono); font-weight: 600; }

/* ===========================================================================
   Components
   =========================================================================== */

/* Pull-quote / key statistic block */
.pull {
  border-left: 3px solid var(--brass);
  padding: 0.5rem 0 0.5rem 1.5rem;
  margin: 2rem 0;
  max-width: var(--measure);
}

.pull-figure {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  line-height: 1;
  color: var(--navy-deep);
  font-variation-settings: "opsz" 144;
  display: block;
  margin-bottom: 0.25rem;
}

.pull-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
}

/* Side card / margin box */
.aside-card {
  background: var(--paper-tint);
  border-top: 2px solid var(--brass);
  padding: 1.5rem;
  margin: 2rem 0;
  font-size: 0.95rem;
  max-width: var(--measure);
}

.aside-card h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brass);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

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

/* Data tables */
.data-table {
  width: 100%;
  max-width: var(--measure);
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: 0.95rem;
}

.data-table caption {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate);
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--navy-deep);
  margin-bottom: 0.5rem;
}

.data-table th, .data-table td {
  padding: 0.7rem 1rem 0.7rem 0;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

.data-table th {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.data-table td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  padding-right: 1.5rem;
}

/* Two-column blocks (sub-section listings) */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.75rem 2.5rem;
  margin: 2rem 0;
}

.two-col article {
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
}

.two-col article h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.two-col article p {
  font-size: 0.95rem;
  color: var(--slate);
  margin: 0;
}

/* Hero block for landing pages */
.hero {
  border-top: 2px solid var(--navy-deep);
  border-bottom: 1px solid var(--rule);
  padding: 3rem 0 3.5rem;
  margin-bottom: 3rem;
  position: relative;
}

.hero-edition {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brass);
  margin-bottom: 1.25rem;
}

.hero h1 {
  max-width: 18ch;
  margin-bottom: 1rem;
}

.hero-deck {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  color: var(--slate);
  max-width: 50ch;
  line-height: 1.4;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem 2.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.hero-stats .pull {
  margin: 0;
  border-left: 2px solid var(--brass);
}

.hero-stats .pull-figure {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
}

/* TOC for handbook landing */
.toc {
  background: var(--paper-tint);
  padding: 2rem;
  margin: 3rem 0;
  border-top: 3px solid var(--navy-deep);
}

.toc h2 {
  margin: 0 0 1.5rem;
  font-size: 1rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--navy-deep);
  font-weight: 600;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  border-top: 1px solid var(--rule);
  padding: 0.85rem 0;
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
}

.toc-list li:last-child { border-bottom: 1px solid var(--rule); }

.toc-num {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--brass);
  font-weight: 600;
  min-width: 2.5em;
}

.toc-list a {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--navy-deep);
  flex: 1;
}

.toc-list a:hover { color: var(--brass); }

.toc-desc {
  font-size: 0.88rem;
  color: var(--slate);
  font-family: var(--font-body);
  flex: 2;
  display: none;
}

@media (min-width: 768px) {
  .toc-desc { display: block; }
}

/* Navigation at bottom of articles (prev/next) */
.article-nav {
  border-top: 2px solid var(--navy-deep);
  margin-top: 4rem;
  padding-top: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  font-size: 0.92rem;
}

.article-nav-prev, .article-nav-next {
  display: block;
  text-decoration: none;
  color: var(--ink-soft);
}

.article-nav-prev:hover, .article-nav-next:hover {
  color: var(--brass);
}

.article-nav-next { text-align: right; }

.article-nav-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate);
  display: block;
  margin-bottom: 0.25rem;
}

.article-nav-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--navy-deep);
}

/* Breadcrumb */
.breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--slate);
  margin-bottom: 1.5rem;
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

.breadcrumb a {
  color: var(--slate);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--brass); }

.breadcrumb span:not(:last-child)::after {
  content: " / ";
  color: var(--brass);
  margin: 0 0.4rem;
}

/* Definition lists for glossary */
.glossary-entry {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0;
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
  gap: 2rem;
  max-width: 88ch;
}

.glossary-entry dt {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--navy-deep);
}

.glossary-entry dt small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brass);
  font-weight: 600;
  margin-top: 0.25rem;
}

.glossary-entry dd { font-size: 0.96rem; }

@media (max-width: 600px) {
  .glossary-entry {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Ornament — small decorative element */
.ornament {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0;
  color: var(--brass);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.2rem;
}

.ornament::before, .ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ===========================================================================
   Footer — colophon style
   =========================================================================== */

.colophon {
  background: var(--navy-deep);
  color: var(--rule);
  padding: 3rem 0 2rem;
  margin-top: 6rem;
}

.colophon a {
  color: var(--rule-soft);
  text-decoration-color: var(--slate);
}

.colophon a:hover {
  color: var(--brass-bright);
  text-decoration-color: var(--brass);
}

.colophon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.colophon h5 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brass-bright);
  font-weight: 600;
  margin-bottom: 1rem;
}

.colophon ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.colophon ul li {
  margin: 0 0 0.6rem;
  font-size: 0.92rem;
}

.colophon-bottom {
  border-top: 1px solid var(--slate);
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate-light);
}

.colophon-imprint {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--rule);
  text-transform: none;
  letter-spacing: normal;
  max-width: 50ch;
  margin-top: 0.5rem;
}

/* Sidenote on stats / figures */
.sidenote {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* SVG map placeholder */
.locator-map {
  border: 1px solid var(--rule);
  background: var(--paper-tint);
  padding: 1.5rem;
  margin: 2rem 0;
  max-width: var(--measure);
}

.locator-map svg { width: 100%; height: auto; display: block; }

.locator-caption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--slate);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
}

/* ===========================================================================
   Figures and images
   =========================================================================== */

.article-figure {
  margin: 2.5rem 0 2rem;
  max-width: 100%;
}

.article-figure.figure-wide {
  max-width: 100%;
}

.article-figure.figure-measure {
  max-width: var(--measure);
}

.article-figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  background: var(--paper-tint);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article-figure figcaption {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--slate);
  margin-top: 0.75rem;
  margin-left: auto;
  margin-right: auto;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
  line-height: 1.5;
  max-width: var(--measure);
  text-align: left;
}

.article-figure figcaption strong {
  color: var(--brass);
  font-weight: 600;
}

.article-figure figcaption em {
  font-family: var(--font-display);
  font-style: italic;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.95rem;
  color: var(--ink-soft);
  display: block;
  margin-top: 0.4rem;
}

/* Hero figure at top of articles - more prominent */
.hero-figure {
  margin: 0 0 3rem;
}

.hero-figure img {
  border: none;
  border-bottom: 2px solid var(--navy-deep);
}

.hero-figure figcaption {
  margin-top: 1rem;
}

/* Inline figure for in-content placement */
.figure-inline {
  margin: 2.5rem 0;
}

@media (max-width: 600px) {
  .article-figure figcaption {
    font-size: 0.7rem;
  }
}

/* Mobile adjustments */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .nav-strip-inner { gap: 0 1.25rem; font-size: 0.7rem; }
  .lead::first-letter { font-size: 3.5rem; }
  .hero-stats { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}

/* Print styles — for handbook PDF export */
@media print {
  body { background: white; font-size: 11pt; }
  .nav-strip, .colophon, .article-nav { display: none; }
  a { color: var(--ink); text-decoration: none; }
  h1, h2, h3 { page-break-after: avoid; }
}
