/* Shipyard guide. Tokens come from the plugin's editorial preset (presets/editorial.tokens.json). */

:root {
  --bg: #faf7f0;
  --fg: #1a1816;
  --card: #fffdf8;
  --muted: #5f574b;
  --line: #e5ddcc;
  --line-strong: #bdb29b;
  --accent: #1d3f72;
  --accent-contrast: #ffffff;
  --focus: #1d3f72;
  --danger: #b3261e;
  --radius: 4px;
  --radius-sm: 2px;

  --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --measure: 40rem;
  --header-h: 3.75rem;
  --gutter: 1rem;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #151310;
  --fg: #efe9dc;
  --card: #1d1a16;
  --muted: #aba292;
  --line: #2e2a23;
  --line-strong: #453f34;
  --accent: #8fb2e8;
  --accent-contrast: #0c1626;
  --focus: #8fb2e8;
  --danger: #f2877d;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

body.nav-open {
  overflow: hidden;
}

@media (min-width: 640px) {
  :root {
    --gutter: 1.5rem;
  }
}

/* ---------- accessibility helpers ---------- */

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.5rem;
}

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

/* ---------- links ---------- */

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line-strong);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 80rem;
  height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  color: var(--fg);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark rect {
  fill: var(--accent);
}

.brand-mark path {
  fill: var(--accent-contrast);
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.top-links {
  display: none;
  margin-left: 1.5rem;
  gap: 0.25rem;
}

.top-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
}

.top-links a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}

.header-link {
  display: none;
  align-items: center;
  min-height: 44px;
  padding: 0 0.75rem;
  color: var(--fg);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
}

.header-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (min-width: 480px) {
  .header-link {
    display: inline-flex;
  }
}

.icon-btn,
.menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.75rem;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.icon-btn {
  padding: 0;
}

.icon-btn:hover,
.menu-btn:hover {
  background: var(--card);
  border-color: var(--fg);
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.menu-btn {
  margin-left: 0.25rem;
}

@media (min-width: 960px) {
  .is-inner .menu-btn {
    display: none;
  }
}

@media (min-width: 760px) {
  .is-home .menu-btn {
    display: none;
  }
  .is-home .top-links {
    display: flex;
  }
}

/* ---------- page shell ---------- */

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "nav"
    "toc"
    "main";
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.side-nav {
  grid-area: nav;
}

.main {
  grid-area: main;
  min-width: 0;
  padding: 1.75rem 0 4rem;
}

.toc {
  grid-area: toc;
}

.is-home .shell {
  grid-template-areas: "main";
}

/* Phone: the menu is a full-width panel under the header, opened with the Menu button.
   Without JavaScript it simply sits above the page. */
.js .side-nav {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 40;
  display: none;
  padding: 1rem var(--gutter) 3rem;
  overflow-y: auto;
  background: var(--bg);
}

.js body.nav-open .side-nav {
  display: block;
}

.side-nav {
  padding: 1rem 0 0.5rem;
  font-size: 1rem;
}

.side-home {
  display: flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 0.5rem;
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.nav-group {
  margin-bottom: 1.25rem;
}

.nav-heading {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.side-nav a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  margin: 0 -0.75rem;
  color: var(--fg);
  text-decoration: none;
  line-height: 1.3;
  border-left: 3px solid transparent;
}

.side-nav a:hover {
  background: var(--card);
}

.side-nav a[aria-current="page"] {
  border-left-color: var(--accent);
  background: var(--card);
  color: var(--accent);
  font-weight: 700;
}

.nav-num {
  flex: none;
  width: 1.4rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

@media (min-width: 960px) {
  .shell {
    grid-template-columns: 16rem minmax(0, 1fr);
    grid-template-areas:
      "nav toc"
      "nav main";
    column-gap: 3rem;
  }
  .js .side-nav {
    position: sticky;
    top: var(--header-h);
    inset: auto;
    z-index: auto;
    display: block;
    align-self: start;
    max-height: calc(100vh - var(--header-h));
    padding: 1.5rem 0 2rem;
    overflow-y: auto;
    background: transparent;
  }
  .side-nav {
    position: sticky;
    top: var(--header-h);
    align-self: start;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    padding: 1.5rem 0 2rem;
  }
  .main {
    padding-top: 2.5rem;
  }
  .is-home .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
  }
  .is-home .side-nav {
    display: none !important;
  }
}

@media (min-width: 1240px) {
  .shell {
    grid-template-columns: 16rem minmax(0, 1fr) 14rem;
    grid-template-areas: "nav main toc";
    column-gap: 3rem;
  }
  .is-home .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "main";
  }
}

/* ---------- on this page ---------- */

.toc {
  margin: 1rem 0 0;
  font-size: 1rem;
}

.toc details {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--card);
}

.toc summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 1rem;
  font-weight: 600;
  cursor: pointer;
}

.toc ol {
  margin: 0;
  padding: 0.25rem 1rem 0.75rem 2.25rem;
}

.toc li {
  margin: 0;
}

.toc li a {
  display: inline-block;
  padding: 0.4rem 0;
  color: var(--fg);
  text-decoration: none;
  line-height: 1.35;
}

.toc li a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (min-width: 960px) and (max-width: 1239px) {
  .toc {
    margin-top: 2.5rem;
    max-width: var(--measure);
  }
}

@media (min-width: 1240px) {
  .toc {
    position: sticky;
    top: calc(var(--header-h) + 2.5rem);
    align-self: start;
    max-height: calc(100vh - var(--header-h) - 4rem);
    margin: 2.5rem 0 0;
    overflow-y: auto;
    font-size: 0.9375rem;
  }
  .toc details {
    border: 0;
    border-left: 1px solid var(--line-strong);
    border-radius: 0;
    background: transparent;
  }
  .toc summary {
    min-height: 0;
    padding: 0 0 0.5rem 1rem;
    color: var(--muted);
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: default;
    pointer-events: none;
    list-style: none;
  }
  .toc summary::-webkit-details-marker {
    display: none;
  }
  .toc ol {
    padding: 0 0 0 1rem;
    list-style: none;
  }
}

/* ---------- reading column ---------- */

.prose > * {
  max-width: var(--measure);
}

.prose > .wide,
.prose > figure.wide {
  max-width: none;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-wrap: balance;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.1rem, 1.5rem + 2.6vw, 3.1rem);
}

.prose h2 {
  margin: 3rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-strong);
  font-size: clamp(1.5rem, 1.3rem + 1vw, 1.9rem);
}

.prose h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.3rem;
}

.prose h4 {
  margin: 1.5rem 0 0.4rem;
  font-size: 1.1rem;
}

.prose p {
  margin: 0 0 1.1rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
}

.prose li {
  margin: 0.4rem 0;
  padding-left: 0.25rem;
}

.prose li > p {
  margin-bottom: 0.5rem;
}

.prose strong {
  font-weight: 700;
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.prose blockquote {
  margin: 1.5rem 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
}

.lead {
  font-family: var(--font-heading);
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.6rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

/* ---------- code ---------- */

code,
pre {
  font-family: var(--font-mono);
}

:not(pre) > code {
  padding: 0.12em 0.35em;
  background: color-mix(in srgb, var(--fg) 7%, var(--bg));
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 1.25rem 0 1.5rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prose pre code {
  font-size: inherit;
}

.code {
  position: relative;
  max-width: var(--measure);
  margin: 1.25rem 0 1.5rem;
}

.code pre {
  margin: 0;
  padding-right: 5.25rem;
}

.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  min-width: 4rem;
  min-height: 2rem;
  padding: 0 0.7rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

/* The tappable area is 44px even though the button looks smaller. */
.copy-btn::after {
  content: "";
  position: absolute;
  inset: -6px;
}

.copy-btn:hover {
  border-color: var(--fg);
  background: var(--card);
}

@media (max-width: 639px) {
  .code {
    display: flex;
    flex-direction: column;
  }
  .code pre {
    padding-right: 1rem;
  }
  .copy-btn {
    position: static;
    order: 2;
    align-self: flex-end;
    min-height: 44px;
    margin-top: 0.4rem;
  }
  .copy-btn::after {
    inset: 0;
  }
}

/* ---------- tables ---------- */

.table-wrap {
  max-width: 100%;
  margin: 1.5rem 0 1.75rem;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.prose > .table-wrap {
  max-width: 100%;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  line-height: 1.45;
}

.table-wrap th,
.table-wrap td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table-wrap th {
  background: var(--card);
  border-bottom: 1px solid var(--line-strong);
  font-weight: 700;
  white-space: nowrap;
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

/* ---------- components ---------- */

.callout {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

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

.steps ol {
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  margin: 0;
  padding: 1rem 0 1rem 3.25rem;
  border-top: 1px solid var(--line-strong);
  counter-increment: step;
}

.steps li:last-child {
  border-bottom: 1px solid var(--line-strong);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 2.25rem;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
}

.steps li > :last-child {
  margin-bottom: 0;
}

.steps li > strong:first-child,
.steps li > p:first-child > strong:first-child {
  font-size: 1.1rem;
}

details.check {
  margin: 1rem 0;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

details.check summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.6rem 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

details.check summary::-webkit-details-marker {
  display: none;
}

details.check summary::before {
  content: "";
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.15rem;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

details.check[open] summary::before {
  transform: rotate(45deg);
}

details.check[open] summary {
  border-bottom: 1px solid var(--line);
}

details.check > :not(summary) {
  margin-left: 1rem;
  margin-right: 1rem;
}

details.check > summary + * {
  margin-top: 0.9rem;
}

details.check > :last-child {
  margin-bottom: 1rem;
}

.video {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.75rem;
  max-width: var(--measure);
  aspect-ratio: 16 / 9;
  margin: 1.25rem 0 2rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.video[data-state="coming"] {
  aspect-ratio: auto;
  min-height: 8rem;
}

.video[data-state="coming"]::before,
.video-play::before {
  content: "";
  display: block;
  margin: 0 auto 0.75rem;
  border-left: 1.1rem solid currentColor;
  border-top: 0.7rem solid transparent;
  border-bottom: 0.7rem solid transparent;
}

.video-play {
  display: block;
  width: 100%;
  height: 100%;
  padding: 1rem;
  background: transparent;
  color: var(--fg);
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.video-play:hover {
  color: var(--accent);
}

.video-fallback {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 0.25rem;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 400;
}

.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video[data-state="playing"] .video-fallback {
  display: none;
}

.video-note {
  max-width: var(--measure);
  margin: -0.25rem 0 1.5rem;
  color: var(--muted);
  font-size: 1rem;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.25rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.button:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--fg));
  border-color: color-mix(in srgb, var(--accent) 86%, var(--fg));
  text-decoration: none;
}

.button.outline {
  background: transparent;
  color: var(--accent);
}

.button.outline:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.75rem 0;
}

/* Previous and next */

.pager {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  max-width: var(--measure);
  margin-top: 3.5rem;
}

.pager a {
  display: block;
  min-height: 44px;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--fg);
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--accent);
  background: var(--card);
}

.pager-next {
  text-align: right;
}

.pager-label {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pager-title {
  display: block;
  margin-top: 0.15rem;
  color: var(--accent);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
}

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

/* ---------- home page ---------- */

.is-home .main {
  padding-top: 2rem;
}

.is-home .prose {
  max-width: 56rem;
  margin-inline: auto;
}

.is-home .prose > * {
  max-width: var(--measure);
}

.is-home .prose > .hero,
.is-home .prose > .wide {
  max-width: none;
}

.hero {
  padding: 1.5rem 0 1rem;
}

.hero h1 {
  max-width: 13em;
  margin: 0 0 1.5rem;
  font-size: clamp(2.6rem, 1.6rem + 5vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.hero .lead {
  max-width: 34rem;
  margin: 0 0 1.5rem;
}

.hero .cta {
  margin: 1.5rem 0 0;
}

.is-home .prose h2 {
  margin-top: 3.5rem;
}

.skills ul {
  margin: 1rem 0 1.5rem;
  padding: 0;
  list-style: none;
}

.skills li {
  margin: 0;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line-strong);
}

.skills li:last-child {
  border-bottom: 1px solid var(--line-strong);
}

.skills li a {
  font-weight: 700;
}

.looks {
  margin: 1.5rem 0 0.5rem;
}

.looks img {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.looks figcaption {
  max-width: var(--measure);
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.site-footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 1.75rem var(--gutter) 3rem;
}

.site-footer p {
  max-width: 48rem;
  margin: 0 0 0.5rem;
}

.site-footer a {
  display: inline-block;
  padding: 0.5rem 0.1rem;
  color: var(--muted);
}

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

/* ---------- print ---------- */

@media print {
  .site-header,
  .side-nav,
  .toc,
  .pager,
  .copy-btn,
  .site-footer {
    display: none !important;
  }
  body {
    font-size: 11pt;
  }
}
