/*
  27hours docs.css
  Theme: Blue-toned, aviation chart (aeronautical/airway manual) vibe with a hint of SCP Foundation Wiki simplicity.

  Design notes:
  - Simple, readable typography
  - Subtle blueprint-like grid background
  - Thin rules, understated borders
  - Content column akin to SCP pages
  - Blue as primary accent; low-saturation neutrals elsewhere
*/

:root {
  --bg: #f6f9fc;                 /* paper-light blue */
  --bg-elev: #ffffff;
  --ink: #0e2740;                /* deep navy ink */
  --muted: #5a6b7b;              /* muted annotations */
  --line: #c9d6e2;               /* thin chart lines */
  --accent: #2a6fcd;             /* airway blue */
  --accent-2: #1f4f96;           /* darker accent */
  --warn: #d99000;               /* NOTAM-like note */
  --ok: #2f8f5b;

  --radius: 8px;
  --shadow: 0 4px 14px rgba(7, 28, 54, 0.08);

  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Roboto Mono", "Noto Sans Mono CJK JP", monospace;

  /* Grid rhythm (3-beat): two thin lines + one stronger line */
  --grid-step: 12px; /* distance between minor grid lines */
  --grid-thin: rgba(42, 111, 205, 0.035); /* subtle minor line */
  --grid-main: rgba(42, 111, 205, 0.10);  /* emphasized every-third line */
  --grid-bold: rgba(42, 111, 205, 0.20);  /* emphasized every-27th line */
  /* Grid origin offset (shift background start point) */
  --grid-offset-x: -6px;
  --grid-offset-y: -6px;
}

/* DSEG7ClassicMini Bold Italic webfont */
@font-face {
  font-family: 'DSEG7ClassicMini';
  src: url('/private/27hours/resource/DSEG7ClassicMini-BoldItalic.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* Bottom-right 7-seg style text clock */
.dseg7 {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  pointer-events: none;
  font-family: 'DSEG7ClassicMini', Consolas, 'Roboto Mono', ui-monospace, monospace;
  font-weight: 700;
  font-style: italic;
  font-size: 72px;
  line-height: 1;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Unlit background layer for 7-seg: faint gray "88:88:88" underneath */
.dseg7-unlit {
  z-index: 9; /* under the lit layer */
  color: var(--dseg-unlit, rgba(28, 49, 71, 0.28));
}

/* Credit link under the 7-seg clock */
.dseg7-credit {
  position: fixed;
  right: 27px;
  bottom: 4px; /* below the clock text (clock bottom is 18px) */
  z-index: 11; /* above unlit/lit layers to ensure clickability */
  pointer-events: auto;
  font-family: var(--font-sans);
  font-size: 8pt;
  line-height: 1;
  color: var(--muted);
}
.dseg7-credit a {
  color: inherit;
  border-bottom: 1px dotted color-mix(in srgb, var(--muted) 70%, transparent);
}
.dseg7-credit a:hover {
  color: var(--accent-2);
  border-bottom-color: currentColor;
  text-decoration: none;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1624;
    --bg-elev: #0f1b2d;
    --ink: #e7eef7;
    --muted: #9ab0c5;
    --line: #28384c;
    --accent: #7bb0ff;
    --accent-2: #98c0ff;
    /* Slightly stronger opacity in dark for equal perceived contrast */
    --grid-thin: rgba(123, 176, 255, 0.07);
    --grid-main: rgba(123, 176, 255, 0.14);
    --grid-bold: rgba(123, 176, 255, 0.28);
    /* Unlit background segment color (faint) */
    --dseg-unlit: rgba(123, 176, 255, 0.20);
  }
}

/* Blueprint-like grid background using layered linear-gradients */
html, body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--bg);
  /* 3-beat grid: two thin lines + one bold line, both axes aligned */
  background-image:
    /* every 27th line strongly emphasized (topmost) */
    repeating-linear-gradient(to bottom, var(--grid-bold) 0 1px, transparent 1px calc(var(--grid-step) * 27)),
    repeating-linear-gradient(to right,  var(--grid-bold) 0 1px, transparent 1px calc(var(--grid-step) * 27)),
    /* minor grid */
    repeating-linear-gradient(to bottom, var(--grid-thin) 0 1px, transparent 1px var(--grid-step)),
    repeating-linear-gradient(to right,  var(--grid-thin) 0 1px, transparent 1px var(--grid-step)),
    /* every third line emphasized */
    repeating-linear-gradient(to bottom, var(--grid-main) 0 1px, transparent 1px calc(var(--grid-step) * 3)),
    repeating-linear-gradient(to right,  var(--grid-main) 0 1px, transparent 1px calc(var(--grid-step) * 3));
  /* Shift the grid origin slightly so the first lines aren't flush to the edges */
  background-position:
    var(--grid-offset-x) var(--grid-offset-y),
    var(--grid-offset-x) var(--grid-offset-y),
    var(--grid-offset-x) var(--grid-offset-y),
    var(--grid-offset-x) var(--grid-offset-y),
    var(--grid-offset-x) var(--grid-offset-y),
    var(--grid-offset-x) var(--grid-offset-y);
  font-family: var(--font-sans);
  line-height: 1.65;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;

  /* 共通SVG時計 */
  background-image: url("/private/27hours/resource/clock.svg");
  background-repeat: no-repeat;
  background-size: 270px auto;
  background-position: 27px 27px;
  opacity: 0.73;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.paper {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  opacity: 0.8;
}

/* Header with airway strip motif */
.masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  padding: 20px 0 12px;
  border-bottom: 2px solid var(--accent);
}

.masthead .title {
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: clamp(24px, 4vw, 34px);
}

.masthead .meta {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* Breadcrumbs inside masthead */
.masthead .breadcrumbs {
  grid-column: 1 / -1; /* span full width under title/meta */
  align-self: start;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.masthead .breadcrumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.masthead .breadcrumbs li {
  display: inline-flex;
  align-items: center;
}
.masthead .breadcrumbs li + li::before {
  content: "›";
  color: var(--line);
  margin: 0 8px;
}
.masthead .breadcrumbs a {
  color: var(--muted);
  border-bottom: 0;
}
.masthead .breadcrumbs a:hover {
  color: var(--accent-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.masthead .breadcrumbs [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

/* Typographic scale */
h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 0.6em 0 0.6em;
}
h1 { font-size: clamp(26px, 4.5vw, 32px); }
h2 { font-size: clamp(22px, 3.8vw, 26px); padding-left: 10px; }
h3 { font-size: clamp(18px, 3.2vw, 22px); color: var(--accent-2); }
h4 { font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

p { margin: 0.9em 0; }
small { color: var(--muted); }

/* Section hierarchy visualizer: add left-borders to paragraphs by depth */
/* Assumption: all text content lives in <p> within nested <section> elements */
.paper {
  /* base depth and steps */
  --sec-depth: 0;
  --sec-indent-step: 12px;   /* horizontal indent per level */
  --sec-border-step: 2px;    /* border width growth per level */
  --sec-border-min: 2px;     /* minimum border width */
  --sec-depth-cap: 4;        /* visual cap to avoid overly thick lines */
}

section { /* each nested section increases depth */
  --sec-depth: calc(var(--sec-depth) + 1);
  border-left: var(--muted) dashed 1px;
  margin-left: 5px; padding-left: 5px;
}

/* Apply depth-based left border and indent to paragraphs inside sections */
section p {
  /* cap depth to keep visuals subtle */
  --_d: clamp(0, var(--sec-depth), var(--sec-depth-cap));
  border-left: calc(var(--sec-border-min) + var(--sec-border-step) * var(--_d)) solid
               color-mix(in srgb, var(--accent) 28%, var(--line) 72%);
  padding-left: calc(10px + var(--sec-indent-step) * var(--_d));
}

/* Avoid double borders inside callouts and blockquotes */
.note p, .warn p, .ok p, blockquote p {
  border-left: 0;
  padding-left: 0;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent);
}
a:hover {
  color: var(--accent-2);
  border-bottom-style: solid;
}

/* Rules and separators reminiscent of chart lines */
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

/* Callouts */
.note, .warn, .ok {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--bg-elev) 92%, var(--accent) 8%);
}
.note { border-left-color: var(--accent); }
.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--bg-elev) 92%, var(--warn) 8%); }
.ok   { border-left-color: var(--ok);   background: color-mix(in srgb, var(--bg-elev) 92%, var(--ok) 8%); }

/* Blocks */
blockquote {
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--bg-elev) 94%, var(--accent) 6%);
}

pre, code, kbd, samp {
  font-family: var(--font-mono);
}
code {
  background: color-mix(in srgb, var(--bg-elev) 88%, var(--accent) 12%);
  color: var(--ink);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--line);
}
pre {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  overflow: auto;
}
pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

/* Tables — clear grid like an approach plate */
div.table-wrapper {
  max-width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
}
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
thead th {
  text-align: left;
  background: color-mix(in srgb, var(--bg-elev) 88%, var(--accent) 12%);
  white-space: nowrap;
}
tbody tr:hover {
  background: color-mix(in srgb, var(--bg-elev) 94%, var(--accent) 6%);
}

/* TOC: page-top navigation (nav.toc) */
nav.toc {
  margin: 12px 0 20px;
  padding: 10px 12px;
  background: var(--bg-elev);
  border-left: 2px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-bottom-left-radius: var(--radius);
}
nav.toc h3 { margin-top: 0; }
nav.toc ul {
  list-style: none;
  margin: 0; /* グローバル ul の margin を無効化 */
  padding: 0;
}
nav.toc li { margin: 6px 0; }
nav.toc a {
  color: var(--accent);
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 40%, transparent);
}
nav.toc a:hover {
  color: var(--accent-2);
  border-bottom-style: solid;
}
/* 番号テキスト（存在する場合） */
nav.toc .num {
  display: inline-block;
  min-width: 2.4em; /* 例: "3.10" 程度を想定して桁揃え */
  color: var(--muted);
}
@media (max-width: 640px) {
  nav.toc { padding: 8px 10px; }
  nav.toc li { margin: 4px 0; }
}

/* Check-in record block (for div.checkin-record and its children) */
.checkin-record {
  margin: 14px 0 18px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
}
.checkin-record h4 {
  /* override generic h4 tint for inside card */
  margin: 0 0 8px;
  color: var(--accent-2);
  letter-spacing: 0.06em;
}
.checkin-record .timestamp {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}
.checkin-record .timestamp time {
  display: inline-block;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--bg-elev) 85%, var(--accent) 15%);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Neutralize global section depth visuals inside the card */
.checkin-record section {
  border-left: 0;
  margin-left: 0;
  padding-left: 0;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px dotted var(--line);
}
.checkin-record section:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}
.checkin-record h5 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--ink);
}
.checkin-record p {
  /* avoid depth-based paragraph borders inside this component */
  border-left: 0;
  padding-left: 0;
  margin: 0.6em 0;
}
.checkin-record ul {
  margin: 0.2rem 0 0.8rem 1.2rem;
}
.checkin-record li {
  margin: 4px 0;
}

@media (max-width: 640px) {
  .checkin-record { padding: 12px 12px; }
}

@media print {
  .checkin-record {
    box-shadow: none;
    background: white;
  }
}

time:not(.noDEC) {
  font-family: 'DSEG7ClassicMini', Consolas, 'Roboto Mono', ui-monospace, monospace;
  letter-spacing: 0.04em;
}

/* Lists — consistent spacing and subtle markers */
ul, ol {
  margin: 0.9em 0 0.9em 1.2em; /* vertical rhythm aligns with <p> */
  padding: 0;
}
li {
  margin: 0.3em 0; /* comfortable spacing between items */
}
/* Marker styling (supported browsers) */
ul li::marker {
  color: color-mix(in srgb, var(--accent) 70%, var(--ink) 30%);
}
ol li::marker {
  color: var(--accent-2);
  font-weight: 600;
}
/* Nested lists get lighter and tighter */
li > ul, li > ol {
  margin-top: 0.3em;
  margin-bottom: 0.3em;
}

/* Definition lists */
dl {
  margin: 1rem 10px;
}
dt {
  font-weight: 700;
  color: var(--accent-2);
}
dd {
  margin-left: 5px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
  margin-bottom: 0.5em;
}

/* Navigation chips like nav aids */
.chip {
  display: inline-block;
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--accent);
  color: var(--accent-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elev) 92%, var(--accent) 8%);
}

/* Footer */
footer {
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding-top: 16px;
}

/* Utility */
.center { text-align: center; }
.right  { text-align: right; }
.muted  { color: var(--muted); }
.wrap   { word-break: break-word; }
.italic { font-style: italic; }

/* Responsive tweaks */
@media (max-width: 768px) {
  .dseg7 {
    font-size: 54px;
  }

  .dseg7-credit {
    right: 20px;
    bottom: 3px;
  }
}

@media (max-width: 640px) {
  .paper { padding: 18px; }
  .masthead { grid-template-columns: 1fr; gap: 6px; }
}

@media (max-width: 480px) {
  .dseg7 {
    font-size: 36px;
  }

  .dseg7-credit {
    right: 14px;
    bottom: 2px;
    font-size: 7pt;
  }
}
