/* ==========================================================================
   Periplus Maritime stylesheet
   Identity per design/README.md: ink / paper / steel, Source Serif 4 +
   IBM Plex Mono, open-ring load-line mark. Steel appears only on the mark's
   waterline, route-divider waypoints, micro-label eyebrows, and link hover.
   ========================================================================== */

:root {
  --ink: #121A29;
  --ink-2: #1B2438;                    /* raised ink, button hover only */
  --paper: #F7F4EC;
  --paper-dim: #F0ECE1;
  --steel: #47678A;
  --text-body: rgba(18, 26, 41, 0.85);
  --text-label: rgba(18, 26, 41, 0.55);
  --text-caption: rgba(18, 26, 41, 0.5);
  --line: rgba(18, 26, 41, 0.14);
  --line-soft: rgba(18, 26, 41, 0.08);
  --line-dark: rgba(247, 244, 236, 0.18);

  --font-display: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1180px;
  --gutter: clamp(20px, 5vw, 48px);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body, h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.12;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  z-index: 1000;
  font-family: var(--font-mono);
  font-size: 14px;
}
.skip-link:focus {
  left: 0;
}

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 26px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 2px;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { transform: translateY(-1px); background: var(--ink-2); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-small { padding: 10px 20px; font-size: 14px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 244, 236, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

/* ---------- Brand lockup (horizontal, per identity spec) ---------- */
.pm-lockup {
  display: flex;
  align-items: flex-start;
  gap: 0.44em;
  text-decoration: none;
  color: var(--ink);
  font-size: 29px;              /* reference set 29/7/6: serif / mono / gap */
}
.pm-mark {
  width: 1.24em;
  height: 1.24em;
  margin-top: 0.12em;
  flex: none;
}
.pm-mark line {
  stroke: var(--steel);
  transition: stroke 175ms ease; /* hover: waterline steel -> ink */
}
.pm-lockup:hover .pm-mark line { stroke: var(--ink); }
.pm-word {
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
}
.pm-name {
  font: 600 1em/1 "Source Serif 4", Georgia, serif;
  letter-spacing: -0.005em;
  margin-bottom: 0.19em;        /* gap = 0.19 x serif size (13px @ 68px sheet) */
}
.pm-desc {
  display: flex;
  justify-content: space-between; /* justified letter-by-letter to "Periplus" width */
  font: 500 0.22em/1 "IBM Plex Mono", monospace;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}
.primary-nav ul {
  display: flex;
  gap: 26px;
}
.primary-nav a:not(.btn) {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-body);
  position: relative;
  padding-bottom: 4px;
  white-space: nowrap;
}
.primary-nav a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--steel);
  transition: width 0.25s var(--ease);
}
.primary-nav a:not(.btn):hover::after { width: 100%; }
.primary-nav a:not(.btn):hover { color: var(--ink); }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.25s var(--ease), opacity 0.25s var(--ease);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: clamp(64px, 12vw, 128px) 0 0;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, black, black 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, black, black 60%, transparent 100%);
}
.hero-inner { position: relative; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.2rem);
  max-width: 15ch;
  margin-bottom: 28px;
}

.hero-sub {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  max-width: 58ch;
  color: var(--text-body);
  margin-bottom: 40px;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 72px;
}

/* ---------- Route divider (secondary brand graphic) ---------- */
.route-band {
  position: relative;
  padding-bottom: 28px;
}
.route-line {
  height: 14px;
  background: url("../assets/route-divider.svg") repeat-x left center;
  background-size: auto 14px;
}
.footer-rule {
  margin-top: -1px; /* sits directly on the contact section's bottom rule */
}

/* ---------- Credibility bar ---------- */
.credibility {
  background: var(--ink);
  color: var(--paper);
  padding: 20px 0;
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}
.credibility-line {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
  line-height: 1.9;
  color: var(--paper);
}
.credibility-line .dot {
  color: rgba(247, 244, 236, 0.55);
  margin: 0 12px;
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(72px, 10vw, 128px) 0;
  border-bottom: 1px solid var(--line);
}
.section-alt { background: var(--paper-dim); }

.section-head { max-width: 640px; margin-bottom: 56px; }

.kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
}

/* ---------- Pillars (What I Do) ---------- */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.pillar {
  padding: 40px 32px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.pillar:first-child { padding-left: 0; }
.pillar:last-child { padding-right: 0; }
.pillar:not(:last-child) { border-right: 1px solid var(--line); }

.pillar-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-label);
  margin-bottom: 16px;
}
.pillar h3 {
  font-size: 1.4rem;
  margin-bottom: 14px;
}
.pillar p {
  color: var(--text-body);
  max-width: 46ch;
}

/* ---------- Steps (How it works) ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
  border-top: 1px solid var(--line);
  padding-top: 48px;
}
.step-num {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-label);
  margin-bottom: 16px;
}
.step h3 {
  font-size: 1.4rem;
  margin-bottom: 14px;
}
.step p {
  color: var(--text-body);
  max-width: 40ch;
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 64px;
  align-items: center;
}
.about-text p:not(.kicker) {
  font-size: 1.05rem;
  color: var(--text-body);
  max-width: 62ch;
}
.about-text h2 { margin-bottom: 24px; }

.about-motif { justify-self: center; }
.about-motif img {
  width: 100%;
  max-width: 240px;
  height: auto;
  margin: 0 auto;
}

/* ---------- About: background & publications ---------- */
.about-record {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  margin-top: 72px;
  padding-top: 56px;
  border-top: 1px solid var(--line);
}
.record-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 8px;
}
.timeline li {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line-soft);
}
.tl-when {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-label);
  padding-top: 3px;
  white-space: nowrap;
}
.tl-role {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.tl-body p:not(.tl-role) {
  font-size: 0.92rem;
  color: var(--text-body);
}
.pubs li {
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.pub-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.pub-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-label);
}
.pub-meta a,
.record-note a {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: color 175ms ease, border-color 175ms ease;
}
.pub-meta a:hover,
.record-note a:hover { color: var(--steel); border-color: currentColor; }
.record-note {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-caption);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 64px;
}
.contact-intro h2 { margin-bottom: 20px; }
.contact-details {
  margin-top: 28px;
  font-size: 1.05rem;
  color: var(--text-body);
  line-height: 2.1;
}
.contact-details a {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: color 175ms ease, border-color 175ms ease;
}
.contact-details a:hover { color: var(--steel); border-color: currentColor; }

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-row label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-label);
}
.form-row input,
.form-row textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 10px 2px;
  font-size: 16px;
  color: var(--ink);
  transition: border-color 0.2s var(--ease);
  resize: vertical;
}
.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--ink);
  outline: none;
}
.contact-form .btn { align-self: flex-start; margin-top: 8px; }

.form-status {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-body);
  min-height: 1.2em;
}
.form-status.is-error { color: #a13a3a; }
.form-status.is-success { color: #2f6d4e; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding: 40px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  gap: 24px;
}
.footer-inner img { flex: none; }
.footer-inner p {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: rgba(247, 244, 236, 0.7);
  max-width: 70ch;
}

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1020px) {
  .nav-toggle { display: flex; }

  .primary-nav {
    position: fixed;
    top: 76px;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(100vh - 76px);
    background: var(--paper);
    flex-direction: column;
    align-items: flex-start;
    padding: 32px var(--gutter);
    gap: 32px;
    transform: translateX(100%);
    transition: transform 0.3s var(--ease);
    overflow-y: auto;
  }
  .primary-nav.is-open { transform: translateX(0); }
  .primary-nav ul {
    flex-direction: column;
    gap: 24px;
    width: 100%;
  }
  .primary-nav ul a { font-size: 1.1rem; }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
}

@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-motif { max-width: 200px; order: -1; }
  .about-record { grid-template-columns: 1fr; gap: 56px; }
  .contact-grid { grid-template-columns: 1fr; gap: 48px; }
  .steps { grid-template-columns: 1fr; gap: 40px; }
  .pillars { grid-template-columns: 1fr; }
  .pillar { padding-left: 0; padding-right: 0; }
  .pillar:not(:last-child) { border-right: none; }
}

@media (max-width: 520px) {
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .tl-when { padding-top: 0; }
}

@media (max-width: 640px) {
  .credibility-line { display: block; }
}
