:root {
  color-scheme: light dark;
  --paper: #f6f3e9;
  --panel: #fffcf2;
  --ink: #193f39;
  --muted: #51645a;
  --rule: #c7c9b9;
  --accent: #975132;
  --wash: #e9ecdf;
  --cta: #24564d;
  --white: #fff9e9;
  --ocean: #284f55;
  --mono: ui-monospace,'SFMono-Regular',Consolas,monospace;
  --serif: Georgia,'Times New Roman',serif;
  font: 16px/1.5 system-ui,sans-serif;
}

@media(prefers-color-scheme:dark) {
  :root {
    --paper: #142622;
    --panel: #1b302b;
    --ink: #f3ebd5;
    --muted: #bdcbbf;
    --rule: #435b50;
    --accent: #efb287;
    --wash: #213b34;
    --cta: #295c51;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: inherit;
  text-underline-offset: 4px;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: .55;
  cursor: default;
}

[hidden] {
  display: none!important;
}

:focus-visible {
  outline: 3px solid #cb703a;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  z-index: 5;
  left: 1rem;
  top: -6rem;
  background: var(--panel);
  padding: 1rem;
}

.skip:focus {
  top: 1rem;
}

.masthead,main,.footer {
  width: min(1220px,calc(100% - clamp(32px,9vw,144px)));
  margin-inline: auto;
}

.masthead {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 15px 0;
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 21px/1 var(--serif);
  letter-spacing: -.05em;
  text-decoration: none;
  white-space: nowrap;
}

.mast-label {
  border-left: 1px solid var(--rule);
  padding-left: 22px;
  color: var(--muted);
}

.contribute {
  font-size: .85rem;
  font-weight: 650;
}

.masthead .contribute {
  margin-left: auto;
}

.contribute span {
  color: var(--accent);
}

.micro,.chart-label,.legend,.entry-top {
  font: 600 .68rem/1.4 var(--mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6%;
  align-items: center;
  padding: clamp(25px,3.6vw,50px) 0;
}

.intro-copy {
  padding-block: 8px;
}

.eyebrow {
  color: var(--accent);
  margin: 0 0 10px;
}

.intro .eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.intro .eyebrow span {
  width: 27px;
  border-top: 2px solid;
}

.intro h1,h2,h3,.entry-name {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
  line-height: 1.08;
  letter-spacing: -.045em;
}

.intro h1 {
  font-size: clamp(4.1rem,6.2vw,6rem);
  line-height: 1;
}

.intro h1 em {
  font-weight: 400;
}

.lede {
  font-size: clamp(1rem,1.4vw,1.22rem);
  color: var(--muted);
  max-width: 43ch;
  margin: 15px 0 20px;
}

.intro-actions,.log-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.intro-actions a {
  font-size: .9rem;
  font-weight: 600;
}

.primary {
  border: 0;
  background: var(--cta);
  color: var(--white);
  min-height: 44px;
  padding: 9px 18px;
  border-radius: 4px;
  font-weight: 650;
}

.primary span {
  margin-left: 10px;
}

.primary:hover:not(:disabled) {
  background: #34685e;
}

.cover {
  margin: 0;
  position: relative;
  border: 1px solid var(--rule);
  padding: 5px;
  background: var(--panel);
  transform: rotate(-.7deg);
}

.cover img {
  display: block;
  width: 100%;
  height: clamp(175px,17.3vw,245px);
  object-fit: cover;
  object-position: 50% 47%;
}

.cover figcaption {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  padding: 8px 7px 3px;
  font-size: .59rem;
}

.section-head {
  border-top: 1px solid var(--rule);
  padding: 20px 0 14px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.section-head .eyebrow {
  margin: 0 0 3px;
}

.section-head h2,.join h2 {
  font-size: clamp(1.9rem,3vw,2.7rem);
}

.section-head>span {
  color: var(--muted);
  text-align: right;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(0,2.55fr) minmax(245px,1fr);
  gap: 14px;
}

.chart-frame,.logbook,.record {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--panel);
}

.chart-frame {
  overflow: hidden;
}

.stage {
  height: clamp(240px,22vw,325px);
  position: relative;
  background: var(--ocean);
  isolation: isolate;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: pan-y;
}

.chart-label,.legend {
  position: absolute;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #153b3ff0;
  color: #fbefcf;
  border: 1px solid #71918c;
  border-radius: 3px;
  padding: 6px 9px;
  letter-spacing: .07em;
}

.chart-label {
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
}

.legend {
  right: 12px;
  bottom: 12px;
  font-size: .58rem;
}

.pulse,.legend-light {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffc66f;
}

.pulse {
  animation: signal 3.8s ease-in-out infinite;
}

.legend-ferry {
  width: 15px;
  border-top: 2px dotted #ace5ce;
}

.legend-light {
  margin-left: 6px;
}

@keyframes signal {
  50% {
    box-shadow: 0 0 0 4px #ffc66f24;
  }
}

@media(prefers-reduced-motion:reduce) {
  .pulse {
    animation: none;
  }
}

#map-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 1.5rem;
  gap: 5px;
  background: repeating-radial-gradient(ellipse at 12% 75%,#305558 0 1px,transparent 2px 30px),#214748;
  color: #f9f0d6;
}

#map-state strong {
  font: 1.9rem/1.1 var(--serif);
}

#map-state span {
  font-size: .9rem;
}

.map-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
}

.map-bar p,#port-by,.entry-by {
  color: var(--muted);
  font-size: .84rem;
  margin: 0;
}

.controls,.log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.controls button,.log-actions button,.copy {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  min-width: 39px;
  min-height: 40px;
  padding: 5px 9px;
}

.controls #overview,.log-actions button,.copy {
  font-size: .8rem;
  font-weight: 600;
}

.controls button:hover:not(:disabled),.log-actions button:hover:not(:disabled),.copy:hover {
  background: var(--wash);
}

.logbook {
  padding: clamp(16px,2vw,29px);
  display: flex;
  flex-direction: column;
  background: var(--wash);
}

.stamp {
  align-self: start;
  margin: 16px 0 7px;
  color: var(--muted);
}

.logbook h3 {
  font-size: clamp(1.7rem,2.5vw,2.4rem);
}

#port-by {
  margin-top: 6px;
}

.stats,#port-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 18px;
  margin: 16px 0;
}

.stats div,#port-stats div {
  display: flex;
  flex-direction: column-reverse;
}

.stats dt,#port-stats dt {
  font: 600 .61rem/1.5 var(--mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats dd,#port-stats dd {
  margin: 0;
  font: 1.19rem/1.3 var(--serif);
}

.log-actions {
  margin-top: auto;
  padding-top: 10px;
}

.log-actions button {
  background: var(--panel);
}

.directory {
  margin: 30px 0;
}

.directory .section-head {
  border: 0;
  padding-top: 0;
}

#island-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,275px),1fr));
  gap: 14px;
}

.record {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.entry {
  display: block;
  text-decoration: none;
  padding: 16px 18px 0;
}

.entry:focus-visible {
  outline-offset: -4px;
}

.entry-top {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.entry-name {
  display: block;
  font-size: 1.6rem;
  margin: 16px 0 4px;
}

.entry:hover .entry-name {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.record:has([aria-current]) {
  border-color: var(--accent);
}

.entry .stats {
  border-block: 1px solid var(--rule);
  padding: 11px 0;
  margin: 14px 0 0;
}

.record-foot {
  padding: 5px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: .76rem;
}

.copy {
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.join {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--wash);
  border-block: 1px solid var(--rule);
  padding: 24px clamp(16px,3vw,40px);
}

.join h2 {
  font-size: 1.85rem;
}

.join p:not(.micro) {
  color: var(--muted);
  font-size: .91rem;
  max-width: 60ch;
  margin: 7px 0 0;
}

.join .eyebrow {
  margin-bottom: 5px;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 22px 0 28px;
  color: var(--muted);
  font-size: .78rem;
}

.footer i {
  margin: 0 4px;
  color: var(--accent);
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.load-note {
  padding: 12px;
  background: var(--wash);
}

@media(max-width:820px) {
  .chart-layout {
    grid-template-columns: minmax(0,1.7fr) minmax(210px,1fr);
  }
  .map-bar {
    flex-wrap: wrap;
  }
  .mast-label {
    display: none;
  }
  .chart-frame {
    display: flex;
    flex-direction: column;
  }
  .stage {
    flex: 1 0 235px;
  }
  .join {
    align-items: start;
    flex-direction: column;
    gap: 12px;
  }
}

@media(max-width:600px) {
  .masthead {
    gap: 10px;
    padding: 10px 0;
  }
  .brand {
    font-size: 18px;
    gap: 6px;
  }
  .brand img {
    width: 28px;
    height: 28px;
  }
  .masthead .contribute {
    font-size: .71rem;
    text-align: right;
    max-width: 18ch;
  }
  .intro {
    position: relative;
    display: block;
    padding: 21px 0;
  }
  .intro-copy {
    padding: 0;
  }
  .intro h1 {
    font-size: clamp(3.5rem,14.5vw,5rem);
  }
  .intro .eyebrow {
    margin-bottom: 5px;
  }
  .lede {
    max-width: 40ch;
    margin: 10px 0 13px;
  }
  .cover {
    display: none;
  }
  .chart-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .stage {
    height: 218px;
    flex: none;
  }
  .map-bar {
    padding: 7px;
    gap: 5px;
    justify-content: center;
  }
  .map-bar p {
    font-size: .74rem;
    text-align: center;
    width: 100%;
  }
  .controls button,.copy,.log-actions button {
    min-height: 44px;
    min-width: 44px;
  }
  .section-head {
    padding: 13px 0 10px;
  }
  .section-head>span {
    max-width: 16ch;
    font-size: .61rem;
  }
  .logbook {
    padding: 15px 18px;
  }
  .logbook .stamp {
    margin: 0 0 5px;
  }
  .logbook .eyebrow {
    margin-bottom: 5px;
  }
  .logbook .log-actions {
    padding: 0;
  }
  .directory {
    margin-block: 22px;
  }
  .footer {
    gap: 9px;
  }
}

.chart-description {
  font-size: .81rem;
  color: var(--muted);
  margin: 8px 0 0;
}

.island-seal {
  float: right;
  width: 59px;
  height: 59px;
  margin: 10px -3px 0 8px;
}

.entry .stats {
  clear: both;
}

#map-caption {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media(max-width:600px) {
  .cover {
    display: block;
    position: absolute;
    right: 0;
    top: 17px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 3px;
    pointer-events: none;
  }
  .cover img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-position: 65% 50%;
  }
  .cover figcaption {
    display: none;
  }
  .intro h1 {
    max-width: calc(100% - 61px);
  }
}

body.on-shore {overflow:hidden}
.on-shore #stage {position:fixed;inset:0;width:100%;height:100dvh;min-height:0;max-height:none;z-index:100;aspect-ratio:auto;border:0;border-radius:0;touch-action:none}
.on-shore #world {width:100%;height:100%;display:block}
.on-shore .chart-label,.on-shore .legend {display:none}
#shore-controls[hidden],#walk-port[hidden] {display:none}
.shore-heading,.shore-help,.shore-pad {position:absolute;z-index:1}
.shore-heading {inset: max(18px,env(safe-area-inset-top)) 18px auto;display:flex;justify-content:space-between;align-items:flex-start;color:#143a38;pointer-events:none}
.shore-heading>div {background:#fff9eaf2;padding:12px 17px;border-radius:4px;box-shadow:0 2px 12px #1233}
.shore-heading span {display:block;font:700 10px monospace;letter-spacing:.18em}
.shore-heading strong {display:block;font:normal clamp(24px,4vw,42px)/1.1 Georgia,serif;margin:4px 0}
.shore-heading small {display:block;font:13px system-ui}
.shore-heading button,.shore-pad button {background:#193f3bf2;color:#fff8e4;border:1px solid #c8dac7;border-radius:5px;padding:10px 14px;cursor:pointer;pointer-events:auto;touch-action:none}
.shore-help {bottom:max(14px,env(safe-area-inset-bottom));left:16px;color:#fff9e9;background:#173b39e8;padding:8px 12px;font-size:13px;border-radius:4px;pointer-events:none}
.shore-pad {right:16px;bottom:max(18px,env(safe-area-inset-bottom));text-align:center;user-select:none}
.shore-pad button {width:43px;height:43px;margin:1px;padding:0}
@media(max-width:520px){.shore-help{bottom:18px;left:9px;max-width:136px;font-size:12px}.shore-heading{left:9px;right:9px}.shore-pad{right:8px}}
#shore-stops{position:absolute;bottom:68px;left:16px;display:flex;gap:3px;padding:3px;border-radius:4px;background:#fff6dfed}
#shore-stops[hidden]{display:none}
#shore-stops button{background:transparent;color:#25443c;border:0;padding:8px 10px;border-radius:3px;font:600 13px system-ui;cursor:pointer}
#shore-stops button:hover,#shore-stops button:focus-visible{background:#d4ddc6}
@media(max-width:520px){#shore-stops{left:9px;bottom:88px}#shore-stops button{padding:6px}}
.cover>a{display:block}
#shore-stops a{align-self:center;margin:0 6px;border-left:1px solid #a3ac96;padding:2px 0 2px 9px;color:#31554b;font:600 12px system-ui;text-decoration:none}
@media(max-width:520px){#shore-stops a{margin:0 3px;padding-left:6px}}
@media(max-width:520px){#shore-stops{top:114px;bottom:auto}.shore-help{margin:0;max-width:162px}.shore-heading small{max-width:185px;overflow-wrap:anywhere}}
