/* 词元码头 · 首页样式
   设计：纸面海图。颜色只在有含义时出现——品红 = 航线与可操作的东西，蓝 = 水深，沙黄 = 陆地，墨 = 文字。 */

@font-face { font-family: "Dock Serif"; src: url("fonts/dock-serif-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Dock Serif"; src: url("fonts/dock-serif-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-400i.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #F7FAFA;
  --paper-veil: rgba(247, 250, 250, 0.88);
  --shoal-1: #DDEDF3;
  --shoal-2: #C4DFEB;
  --dry: #CADDB7;
  --land: #EFE0AB;
  --land-line: #CDB77C;
  --ink: #18232E;
  --ink-2: #4B5A68;
  --ink-3: #64717D;
  --hydro: #3B7390;
  --contour: #8DBACD;
  --contour-2: #7FAEC4;
  --magenta: #B0156D;
  --magenta-ink: #8C0F56;
  --magenta-wash: rgba(176, 21, 109, 0.07);
  --buoy-red: #C8352F;
  --buoy-green: #2F8A57;
  --code-bg: #0F1D29;
  --code-ink: #D6E2EA;
  --code-dim: #7D93A4;
  --code-str: #F08BC4;
  --rule: rgba(24, 35, 46, 0.16);

  --f-serif: "Dock Serif", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --f-latin: "Newsreader", "Dock Serif", Georgia, "Times New Roman", serif;
  --f-sans: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --m: clamp(12px, 1.6vw, 22px);      /* 图廓外留白 */
  --nav-h: 64px;
  --frame-h: clamp(600px, calc(100svh - var(--nav-h) - var(--m)), 1180px);
}

html[data-theme="night"] {
  color-scheme: dark;
  --paper: #0A141D;
  --paper-veil: rgba(10, 20, 29, 0.86);
  --shoal-1: #0E2130;
  --shoal-2: #132B3C;
  --dry: #172A21;
  --land: #1F1B13;
  --land-line: #3A331F;
  --ink: #D5E0E8;
  --ink-2: #9CAFBE;
  --ink-3: #6E8292;
  --hydro: #6FA2BC;
  --contour: #24475B;
  --contour-2: #2B566C;
  --magenta: #E25AA8;
  --magenta-ink: #F07CBD;
  --magenta-wash: rgba(226, 90, 168, 0.10);
  --buoy-red: #D9564F;
  --buoy-green: #3FA56C;
  --code-bg: #060E15;
  --rule: rgba(213, 224, 232, 0.14);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 var(--f-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--f-serif); font-weight: 700; color: var(--ink); }
:focus-visible { outline: 2px solid var(--magenta); outline-offset: 3px; border-radius: 2px; }
::selection { background: rgba(176, 21, 109, 0.18); }
[hidden] { display: none !important; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 8px 14px; text-decoration: none; border-radius: 3px;
}
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px;
  border: 1px solid transparent; border-radius: 3px;
  font: 600 15px/1 var(--f-sans); letter-spacing: 0.04em;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--magenta); color: #fff; }
.btn-primary:hover { background: var(--magenta-ink); }
html[data-theme="night"] .btn-primary { color: #1A0712; }
.btn-line { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-line:hover { background: var(--ink); color: var(--paper); }
.btn-sm { height: 36px; padding: 0 15px; font-size: 14px; }

/* ---------------------------------------------------------------- top margin (nav) */
.topbar {
  height: var(--nav-h);
  padding: 0 var(--m);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand img { width: 30px; height: 30px; }
.brand-name { font: 700 19px/1 var(--f-serif); letter-spacing: 0.08em; white-space: nowrap; }
.brand-no { font: italic 400 14px/1 var(--f-latin); color: var(--ink-3); white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a:not(.btn), .night {
  font: 500 14.5px/1 var(--f-sans); color: var(--ink-2); text-decoration: none;
  padding: 10px 11px; border-radius: 3px; background: none; border: 0; cursor: pointer;
}
.nav a:not(.btn):hover, .night:hover { color: var(--ink); background: var(--magenta-wash); }
.nav .btn { margin-left: 8px; }
.night { display: inline-flex; align-items: center; gap: 6px; }
.night svg { width: 15px; height: 15px; }
.night[aria-pressed="true"] { color: var(--magenta); }
.nav-sep { width: 1px; height: 18px; background: var(--rule); margin: 0 6px; }

/* ---------------------------------------------------------------- hero / chart */
.hero { position: relative; }
.chart-frame {
  position: relative;
  margin: 0 var(--m) var(--m);
  height: var(--frame-h);
  overflow: hidden;
  background: var(--paper);
  isolation: isolate;
}
.chart { position: absolute; inset: 0; width: 100%; height: 100%; }
.neatline { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.nl-fill { fill: var(--ink); }
.nl-out { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.nl-in { fill: none; stroke: var(--ink); stroke-width: .8; }
.nl-lab text { font: italic 400 12px var(--f-latin); fill: var(--ink-2); paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }

/* 底图 */
.band.b10 { fill: var(--shoal-1); stroke: var(--contour); stroke-width: .7; }
.band.b5 { fill: var(--shoal-2); stroke: var(--contour-2); stroke-width: .7; }
.band.dry { fill: var(--dry); stroke: color-mix(in srgb, var(--dry) 60%, var(--ink) 25%); stroke-width: .5; }
.band.land { fill: var(--land); stroke: var(--ink); stroke-width: 1.1; }
.cl { fill: none; stroke: var(--contour); stroke-width: .6; }
.cl.c2 { stroke: var(--contour-2); stroke-dasharray: 2 2; }
.hl { fill: none; stroke: var(--land-line); stroke-width: .6; }
#soundings text { font: italic 400 13px var(--f-latin); fill: var(--hydro); }
#soundings .sub { font-size: 9.5px; }
#clabels text { font: italic 400 12px var(--f-latin); fill: var(--hydro); opacity: .85; text-anchor: middle; paint-order: stroke; stroke: var(--paper); stroke-width: 4px; }
.wn {
  font: 400 15px var(--f-serif); fill: var(--hydro); letter-spacing: .25em; text-anchor: middle;
  transform: skewX(14deg); transform-box: fill-box; transform-origin: center;   /* 水系用左斜宋 */
}
.wn.big { font-size: 30px; letter-spacing: 1.1em; opacity: .5; }
.land-name { font: 700 15px var(--f-serif); fill: var(--ink); }
.land-name.sm { font-size: 13px; font-weight: 400; }
.dredge { fill: none; stroke: var(--ink); stroke-width: .8; stroke-dasharray: 5 3; opacity: .75; }
.dredge-t { font: 400 11px var(--f-serif); fill: var(--ink-2); text-anchor: middle; }
.pier { fill: var(--ink); }
.shed { fill: none; stroke: var(--ink); stroke-width: .8; }
.bollard { fill: var(--land); }
.rock { stroke: var(--ink); stroke-width: 1; }
.rock-dot { fill: var(--ink); }
.buoy path { stroke: var(--ink); stroke-width: .8; }
.buoy.g path { fill: var(--buoy-green); }
.buoy.r path { fill: var(--buoy-red); }
.buoy text { font: italic 400 10.5px var(--f-latin); fill: var(--ink); }
.fw-ring { fill: none; stroke: var(--magenta); stroke-width: 1.2; }
.fw-dot { fill: var(--magenta); }
.fairway text { font: 400 12px var(--f-serif); fill: var(--ink); }
.flare { fill: var(--magenta); }
.lt-dot, .lt-star { fill: var(--ink); }
.lt-q { font: italic 400 12.5px var(--f-latin); fill: var(--magenta); }
.anch-ring { fill: none; stroke: var(--magenta); stroke-width: 1; stroke-dasharray: 4 3; }
.anch-sym { fill: none; stroke: var(--magenta); stroke-width: 1.4; }
.anch text { font: 400 11px var(--f-serif); fill: var(--magenta); text-anchor: middle; }
.spot path { fill: var(--ink); }
.spot text { font: 500 11px var(--f-latin); fill: var(--ink); }
.rose-ring { fill: none; stroke: var(--magenta); stroke-width: 1; }
.rose-ring.thin { stroke-width: .6; }
.rose-tick { stroke: var(--magenta); stroke-width: .8; }
.rose-num { font: 500 8.5px var(--f-latin); fill: var(--magenta); text-anchor: middle; }
.rose-needle { fill: var(--magenta); opacity: .85; }
.rose-star { fill: var(--magenta); }
.rose-star.hollow { fill: var(--paper); }
.rose-var { font: 400 8.5px var(--f-serif); fill: var(--magenta); text-anchor: middle; }
.rose-var.sm { font-size: 7.5px; }

/* 航线 */
.route { fill: none; stroke: var(--magenta); stroke-width: 2; stroke-dasharray: 10 5; transition: stroke-width .2s ease, opacity .2s ease; }
.rlabel .port { font: 700 15px var(--f-serif); fill: var(--magenta); }
.rlabel .port-sub { font: italic 400 13px var(--f-latin); fill: var(--magenta); opacity: .85; }
.rletter circle { fill: var(--paper); stroke: var(--magenta); stroke-width: 1.2; }
.rletter text { font: italic 500 13px var(--f-latin); fill: var(--magenta); text-anchor: middle; }
.rlabel, .rletter, .route { cursor: pointer; }
#routes-g.has-focus .route:not(.on) { opacity: .25; }
#routes-g.has-focus ~ #route-labels .rlabel:not(.on),
#routes-g.has-focus ~ #route-labels .rletter:not(.on) { opacity: .3; }
.route.on { stroke-width: 3; }

/* 船舶（AIS 目标）：去程空心、回程实心 */
.ship path { stroke: var(--ink); stroke-width: 1.1; fill: var(--paper); }
.ship.in path { fill: var(--ink); }
.ship line { stroke: var(--ink); stroke-width: 1; }

/* 图题框（落在陆地上） */
.cartouche {
  position: absolute; z-index: 3;
  left: calc(var(--m) + clamp(28px, 4.4vw, 84px));
  top: calc(var(--nav-h) + var(--frame-h) / 2); transform: translateY(-50%);
  width: min(36vw, 560px);
}
.cartouche h1 {
  font-size: clamp(54px, 6.6vw, 104px); line-height: 1.02; letter-spacing: .08em;
  margin-left: -0.04em;
}
.cartouche .latin { margin-top: 10px; font: italic 400 clamp(19px, 1.7vw, 24px)/1.2 var(--f-latin); color: var(--hydro); letter-spacing: .01em; }
.cartouche .tagline { margin-top: 26px; font: 400 clamp(19px, 1.55vw, 23px)/1.6 var(--f-serif); max-width: 22em; }
.cartouche .sub { margin-top: 12px; font-size: 15.5px; line-height: 1.75; color: var(--ink-2); max-width: 30em; }
.cta { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; }
.endpoint {
  margin-top: 22px; display: flex; align-items: stretch; max-width: 470px;
  border: 1px solid var(--ink); background: var(--paper-veil);
}
.endpoint-label { flex: none; display: flex; align-items: center; padding: 0 12px; font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--rule); }
.endpoint code {
  flex: 1; min-width: 0; display: flex; align-items: center; padding: 10px 12px;
  font: 500 16px/1.2 var(--f-latin); letter-spacing: .01em; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.copy {
  flex: none; border: 0; border-left: 1px solid var(--ink); background: transparent; color: var(--magenta);
  font: 600 14px/1 var(--f-sans); padding: 0 16px; cursor: pointer; min-width: 74px;
}
.copy:hover { background: var(--magenta-wash); }
.copy.done { color: var(--buoy-green); }
.legend { margin-top: 16px; font-size: 12.5px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { width: 22px; height: 10px; }

/* 光标测深读数 */
.readout {
  position: absolute; z-index: 3; right: 24px; bottom: 24px;
  display: flex; gap: 14px; align-items: baseline;
  padding: 7px 12px; border: 1px solid var(--ink); background: var(--paper-veil);
  font: italic 400 14px/1.2 var(--f-latin); color: var(--ink);
  pointer-events: none;
}
.readout b { font: 600 13px/1.2 var(--f-sans); font-style: normal; color: var(--hydro); }
.readout .lbl { font: 400 12.5px var(--f-sans); font-style: normal; color: var(--ink-2); }
@media (hover: none) { .readout { display: none; } }

/* ---------------------------------------------------------------- sections */
.wrap { width: min(1180px, calc(100% - 2 * var(--m) - 24px)); margin: 0 auto; }
.section { padding: clamp(72px, 9vw, 120px) 0 0; }
.section h2 { font-size: clamp(28px, 3vw, 38px); line-height: 1.25; letter-spacing: .04em; }
.section .lead { margin-top: 14px; max-width: 40em; color: var(--ink-2); font-size: 16px; }

/* 航线表 */
.rtable { width: 100%; margin-top: 40px; border-collapse: collapse; }
.rtable th { text-align: left; font: 500 13px var(--f-sans); color: var(--ink-3); padding: 0 16px 12px 0; border-bottom: 1.5px solid var(--ink); }
.rtable td { padding: 22px 16px 22px 0; border-bottom: 1px dashed var(--contour-2); vertical-align: top; }
.rtable tbody tr { transition: background-color .15s ease; }
.rtable tbody tr:hover, .rtable tbody tr.flash { background: var(--magenta-wash); }
.rtable tbody tr.flash { transition: background-color .3s ease; }
.rtable .rid { width: 120px; padding-left: 4px; }
.rglyph { width: 96px; height: 24px; overflow: visible; }
.rglyph line { stroke: var(--magenta); stroke-width: 2; stroke-dasharray: 8 4; }
.rglyph circle { fill: var(--paper); stroke: var(--magenta); stroke-width: 1.2; }
.rglyph text { font: italic 500 13px var(--f-latin); fill: var(--magenta); text-anchor: middle; }
.rclient strong { display: block; font: 600 18px/1.3 var(--f-latin); letter-spacing: .01em; }
.rclient span, .rapi span { display: block; margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.rapi code, .inline-code { font: 500 15px var(--f-latin); color: var(--ink); background: var(--magenta-wash); padding: 1px 6px; border-radius: 2px; }
.rmodels { color: var(--ink); }
.tnote { margin-top: 16px; font-size: 14px; color: var(--ink-3); }
.tnote a { color: var(--magenta); text-underline-offset: 3px; }

/* 三步接入：航路点 */
.waypoints { list-style: none; margin: 44px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; position: relative; }
.waypoints::before {
  content: ""; position: absolute; left: 18px; right: calc(33.33% - 18px); top: 18px; height: 0;
  border-top: 2px dashed var(--magenta);
}
.waypoints li { position: relative; padding-top: 58px; }
.wp {
  position: absolute; top: 0; left: 0; width: 38px; height: 38px; border-radius: 50%;
  border: 1.5px solid var(--magenta); background: var(--paper);
  display: grid; place-items: center; font: italic 500 18px/1 var(--f-latin); color: var(--magenta);
}
.wp::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 1px solid var(--magenta); opacity: .35; }
.waypoints h3 { font-size: 21px; letter-spacing: .04em; }
.waypoints p { margin-top: 8px; color: var(--ink-2); font-size: 15.5px; max-width: 24em; }
.waypoints .go { display: inline-block; margin-top: 12px; color: var(--magenta); font-weight: 600; font-size: 15px; text-decoration: none; border-bottom: 1px solid currentColor; padding-bottom: 1px; }
.waypoints .go:hover { color: var(--magenta-ink); }

/* 配置面板：夜航图插页 */
.config { margin-top: 48px; background: var(--code-bg); color: var(--code-ink); border-radius: 4px; overflow: hidden; }
.config-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px 0; border-bottom: 1px solid rgba(214, 226, 234, .12); }
.tabs, .os { display: flex; gap: 2px; flex-wrap: wrap; }
.tab, .os button {
  border: 0; background: none; color: var(--code-dim); cursor: pointer;
  font: 500 14px/1 var(--f-sans); padding: 12px 14px 13px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--code-ink); border-bottom-color: #E25AA8; }
.tab:hover, .os button:hover { color: var(--code-ink); }
.os button { font-size: 13px; padding: 8px 10px 11px; }
.os button[aria-pressed="true"] { color: var(--code-ink); }
.config-body { position: relative; padding: 18px 20px 22px; }
.config-file { font: italic 400 14px var(--f-latin); color: var(--code-dim); }
.config pre { margin: 10px 0 0; overflow-x: auto; font: 400 14.5px/1.75 var(--f-mono); color: var(--code-ink); tab-size: 2; }
.config pre .c { color: var(--code-dim); }
.config pre .s { color: var(--code-str); }
.config pre .k { color: #9FD0E6; }
.config .copy { position: absolute; top: 12px; right: 12px; border: 1px solid rgba(214, 226, 234, .3); color: var(--code-ink); padding: 9px 14px; border-radius: 3px; min-width: 0; }
.config .copy:hover { background: rgba(214, 226, 234, .08); }
.config .copy.done { color: #7DDBA3; }
.config-note { margin-top: 14px; font-size: 14px; color: var(--ink-3); }

/* 港务通告 */
.notices-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); margin-top: 8px; }
.nm { list-style: none; margin: 32px 0 0; padding: 0; }
.nm li { display: grid; grid-template-columns: 92px 1fr; gap: 6px 18px; padding: 20px 0; border-top: 1px solid var(--rule); }
.nm li:last-child { border-bottom: 1px solid var(--rule); }
.nm-no { font: 700 15px/1.6 var(--f-serif); color: var(--magenta); }
.nm time { display: block; font: italic 400 14px var(--f-latin); color: var(--ink-3); }
.nm p { grid-column: 2; grid-row: 1 / span 2; color: var(--ink); }
.office { margin-top: 32px; padding: 26px 26px 28px; background: var(--land); border: 1px solid var(--ink); position: relative; }
.office h3 { font-size: 20px; letter-spacing: .06em; }
.office .contact { margin-top: 12px; white-space: pre-line; color: var(--ink); }
.office ul { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.office li a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--land-line); font-weight: 500; }
.office li a:hover { color: var(--magenta); border-color: currentColor; }
.office li span { color: var(--ink-2); font-size: 14px; margin-left: 8px; }

/* 页脚：图廓外注记 */
.foot { margin-top: clamp(80px, 10vw, 132px); border-top: 1.5px solid var(--ink); }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 18px 32px; padding: 26px 0 34px; }
.foot .ed { font: italic 400 15px var(--f-latin); color: var(--ink-2); }
.foot .ed span { font-family: var(--f-sans); font-style: normal; font-size: 14px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14.5px; }
.foot nav a { color: var(--ink-2); text-decoration: none; }
.foot nav a:hover { color: var(--magenta); }
.scale { display: flex; align-items: flex-end; gap: 10px; color: var(--ink-2); font: italic 400 13px var(--f-latin); }
.scale svg { width: 190px; height: 18px; }
.scale rect { stroke: var(--ink); stroke-width: 1; }
.scale .f { fill: var(--ink); }
.scale .e { fill: var(--paper); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .nav .opt { display: none; }
  .cartouche { width: min(42vw, 520px); }
}
@media (max-width: 820px) {
  :root { --nav-h: 58px; }
  .brand-no, .nav .anchor, .nav-sep { display: none; }
  .nav a.nav-login { padding: 10px 8px; }
  .nav .btn { margin-left: 4px; }
  :root { --frame-h: clamp(340px, 58svh, 560px); }
  .chart-frame { margin-bottom: 0; }
  .cartouche {
    position: relative; left: auto; top: auto; transform: none; width: auto;
    margin: 0 var(--m); padding: 30px 22px 28px;
    background: var(--land); border: 1px solid var(--ink); border-top: 0;
  }
  .cartouche h1 { font-size: clamp(46px, 13vw, 64px); }
  .readout { display: none; }
  .waypoints { grid-template-columns: 1fr; gap: 28px; }
  .waypoints::before { left: 18px; right: auto; top: 18px; bottom: 18px; height: auto; border-top: 0; border-left: 2px dashed var(--magenta); }
  .waypoints li { padding: 0 0 0 60px; min-height: 40px; }
  .notices-grid { grid-template-columns: 1fr; }
  .rtable thead { display: none; }
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: auto; }
  .rtable tr { padding: 18px 0; border-bottom: 1px dashed var(--contour-2); }
  .rtable td { border: 0; padding: 4px 0; }
  .rtable .rid { width: auto; padding: 0 0 6px; }
}
@media (max-width: 420px) {
  .nav .night span { display: none; }
  .btn { padding: 0 18px; }
  .endpoint-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
