/* Kipin — home page "Carte marine" (M4). Face 1: sea chart + ink sailboat menu; face 2: contact over the sea.
   Fonts are self-hosted (CSP font-src 'self'): TeX Gyre Chorus + Pagella (GUST Font License), Cormorant Garamond (OFL). */
@font-face { font-family: "Logbook"; src: url(fonts/texgyrechorus-mediumitalic.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Pagella"; src: url(fonts/texgyrepagella-regular.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Pagella"; font-style: italic; src: url(fonts/texgyrepagella-italic.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap;
  src: url(fonts/cormorant-garamond-cyrillic-500-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap;
  src: url(fonts/cormorant-garamond-latin-ext-500-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap;
  src: url(fonts/cormorant-garamond-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --ink: #221e18;
  --ink-hover: #8b5a1c;
  --paper: #e4cfa8;
  --paper-fill: #e9d6b3;              /* centre colour of the parchment: hull + sails hide what is behind them */
  --ease: cubic-bezier(.65, 0, .25, 1);
  --bw: min(92vw, 110vh);              /* boat drawing width (svg viewBox 880 x 520) */
  --bh: calc(var(--bw) * .5909);
  --bt: calc(15vh + (85vh - var(--bh)) / 2);   /* below the welcome band, centred in the rest */
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font-family: "Pagella", Georgia, serif; }

/* ---------- cube ---------- */
/* 3D only WHILE turning (body.turning, set by home.js). At rest the visible face is a plain flat page and the other
   face is hidden: Chromium cannot hit-test inside a resting preserve-3d cube (clicks fell through to .cube, the
   form fields could not get the cursor). Without JS the page is always in the flat rest state. */
.cube { position: fixed; inset: 0; perspective: 1800px; }
.cube-inner { position: absolute; inset: 0; transform-style: preserve-3d; }
.face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; }
.face.home { background: var(--paper); }
.face.contact { background: #cfd6d6 url(poster-c.jpg) 0 0 / auto calc(100vh / .536) no-repeat; }
.face-1 .face.contact, .face-2 .face.home { visibility: hidden; }
.turning .face.home, .turning .face.contact { visibility: visible; }   /* same weight as the hiding rule above, and later */
.turning .cube-inner { transform: translateZ(-50vh) rotateX(0deg); }
.turning.face-2 .cube-inner { transform: translateZ(-50vh) rotateX(90deg); }
.turning .face.home { transform: translateZ(50vh); }
.turning .face.contact { transform: rotateX(-90deg) translateZ(50vh); }
.turning.anim .cube-inner { transition: transform 1.15s var(--ease); }

/* ---------- face 1: parchment + chart ---------- */
.paperbg { position: absolute; inset: 0; background: var(--paper) url(paper.jpg) center / cover;
  background-image: image-set(url(paper.webp) type("image/webp"), url(paper.jpg) type("image/jpeg")); }
.chart { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.c-thin { stroke: var(--ink); stroke-width: .6; opacity: .35; }
.c-land { stroke: none; opacity: .75; }
.c-coast { stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
path.c-coast:not([fill]) { fill: none; }
.c-depth { fill: none; stroke: var(--ink); stroke-width: .9; }
.c-light path { fill: var(--ink); }
.c-light .c-flare { fill: rgba(176, 58, 122, .32); }
.c-label { font-family: "Pagella", Georgia, serif; font-style: italic; fill: var(--ink); }
.c-label.small { font-size: 18px; }
.c-label.sea { font-size: 24px; font-style: normal; letter-spacing: .6em; opacity: .62; }
.c-label.rose-n { font-size: 28px; font-style: normal; text-anchor: middle; }
.c-rhumb { stroke: var(--ink); stroke-width: .5; opacity: .14; }
.c-rhumb.major { opacity: .24; }
.c-ring { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.c-ring.thin { stroke-width: .7; }
.c-tick { stroke: var(--ink); stroke-width: .8; }
.c-star { fill: var(--paper-fill); stroke: var(--ink); stroke-width: .8; stroke-linejoin: round; }
.c-star.dark { fill: var(--ink); }
.c-sound { font-family: "Pagella", Georgia, serif; font-style: italic; font-size: 15px; fill: var(--ink); opacity: .5; text-anchor: middle; }
.c-box { fill: var(--paper-fill); fill-opacity: .75; stroke: var(--ink); stroke-width: 1.2; }
.c-box.thin { fill: none; stroke-width: .6; }
.c-title { font-family: "Pagella", Georgia, serif; font-size: 18px; letter-spacing: .2em; text-anchor: middle; fill: var(--ink); }
.c-sub { font-family: "Logbook", serif; font-size: 20px; text-anchor: middle; fill: var(--ink); }
.c-sub.small { font-size: 15px; opacity: .8; }
@media (max-aspect-ratio: 3/2) { .c-cart { display: none; } }   /* squarish windows: the boat needs the room */

/* graduated chart border around the window (always complete, whatever its shape) */
.chart-frame { position: absolute; inset: 14px; pointer-events: none; border: 1.4px solid var(--ink); }
.chart-frame::before { content: ""; position: absolute; inset: 0; opacity: .85;
  background:
    repeating-linear-gradient(90deg, var(--ink) 0 40px, transparent 40px 80px) top left / 100% 10px no-repeat,
    repeating-linear-gradient(90deg, var(--ink) 0 40px, transparent 40px 80px) bottom left / 100% 10px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 40px, var(--ink) 40px 80px) top left / 10px 100% no-repeat,
    repeating-linear-gradient(180deg, transparent 0 40px, var(--ink) 40px 80px) top right / 10px 100% no-repeat; }
.chart-frame::after { content: ""; position: absolute; inset: 10px; border: .7px solid var(--ink); }

.logo { position: absolute; z-index: 1; left: clamp(36px, 5vw, 96px); top: 24px; display: block;
  filter: drop-shadow(0 0 5px var(--paper-fill)) drop-shadow(0 0 10px var(--paper-fill)) drop-shadow(0 0 18px var(--paper-fill)); }
.logo img { display: block; height: clamp(54px, 8vh, 76px); width: auto; }
.hero { position: absolute; z-index: 1; left: 50%; top: 4.5vh; transform: translateX(-50%); width: max-content; max-width: 80vw; text-align: center; }
.eyebrow { margin: 0; letter-spacing: .32em; font-size: .78rem; font-weight: 600; font-family: system-ui, sans-serif; opacity: .75; }
.hero h1 { margin: .2em 0 0; font-family: "Cormorant Garamond", "Pagella", Georgia, serif; font-weight: 500;
  font-size: clamp(1.8rem, 3.1vw, 2.9rem); line-height: 1.1; transition: opacity .6s, filter .6s;
  text-shadow: 0 0 6px var(--paper-fill), 0 0 14px var(--paper-fill); }
.hero h1.out { opacity: 0; filter: blur(6px); }

/* ---------- the boat = the menu ---------- */
.boat { position: fixed; z-index: 3; left: 50%; top: var(--bt); width: var(--bw); transform: translateX(-50%); transform-origin: 100% 0; }
.ready .boat { transition: transform 1.1s var(--ease), left 1.1s var(--ease), top 1.1s var(--ease); }
.boat svg { display: block; width: 100%; height: auto; overflow: visible; }
.face-2 .boat { left: 98vw; top: 3vh; transform: translateX(-100%) scale(.26); }
.face-2 .boat:hover, .face-2 .boat:focus-within { transform: translateX(-100%) scale(.5); }
.face-2 .boat::before { content: ""; position: absolute; z-index: -1; inset: -3% 17% 4% 6%; border-radius: 22px;
  background: rgba(251, 247, 238, .85); box-shadow: 0 8px 30px rgba(40, 30, 10, .18); transition: inset .3s; }
.face-2 .boat:hover::before, .face-2 .boat:focus-within::before { inset: -4% -2%; }
.face-2 .hullfill, .face-2 .wash, .face-2 a.part:hover .wash { fill: #fbf7ee; }   /* the small boat sits on the cream card */
.face-2 .cap { stroke: #fbf7ee; }
.face-2 .cap, .face-2 .lead, .face-2 .gulls { opacity: 0 !important; transition: opacity .3s; }
.face-2 .boat:hover .cap, .face-2 .boat:hover .lead, .face-2 .boat:focus-within .cap, .face-2 .boat:focus-within .lead { opacity: 1 !important; }

.rock { transform-box: view-box; transform-origin: 300px 395px; animation: rock 7.7s ease-in-out infinite; }
@keyframes rock { 0%, 100% { transform: rotate(-1.3deg) translateY(0); } 50% { transform: rotate(1.3deg) translateY(4px); } }
.flag { transform-box: fill-box; transform-origin: 0 50%; }
@keyframes flutter { from { transform: skewY(-3deg) scaleX(.97); } to { transform: skewY(3deg) scaleX(1.02); } }

.ink { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw 1.3s ease-in-out forwards; transition: stroke .25s; }
.ink.thin { stroke-width: 1.3; }
.ink.ghost { stroke-width: .9; opacity: .45; }
.ink.flag { animation: draw 1.3s ease-in-out forwards, flutter 1.6s ease-in-out infinite alternate; }
.dash { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 4 4; }
.hatchline { stroke: var(--ink); stroke-width: .7; opacity: .5; }
.fade { opacity: 0; animation: fade 1s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
.d1 { animation-delay: .1s; } .d2 { animation-delay: .5s; } .d3 { animation-delay: .9s; } .d4 { animation-delay: 1.3s; }
.d5 { animation-delay: 1.7s; } .d6 { animation-delay: 1.9s; } .d7 { animation-delay: 1.2s; } .d8 { animation-delay: 2.1s; }
.ink.flag.d4 { animation-delay: 1.3s, 0s; }

.hullfill { fill: var(--paper-fill); stroke: none; }
.hit { fill: transparent; stroke: none; }
.wash { fill: var(--paper-fill); transition: fill .3s; }
.cap { font-family: "Logbook", "Pagella", serif; font-size: 23px; fill: var(--ink); opacity: 0; animation: fade 1s ease 2.2s forwards;
  transition: fill .25s; paint-order: stroke; stroke: var(--paper-fill); stroke-width: 6px; stroke-linejoin: round; }
.soon { opacity: .6; }
.lead { stroke-dasharray: 1 1; }
.part { cursor: pointer; outline: none; }
a.part:hover .ink, a.part:focus-visible .ink, a.part:hover .dash, a.part:focus-visible .dash { stroke: var(--ink-hover); }
a.part:hover .cap, a.part:focus-visible .cap { fill: var(--ink-hover); text-decoration: underline; text-underline-offset: 4px; }
a.part:hover .wash, a.part:focus-visible .wash { fill: #e4c99a; }
.part.free { cursor: default; }
.part.free:hover .wash { fill: #e4c99a; }   /* same warm highlight as the links (was almost the parchment colour) */

.gull { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linecap: round; opacity: 0; animation: fly 36s linear infinite; }
.g2 { animation-duration: 49s; animation-delay: -21s; }
@keyframes fly {
  0% { opacity: 0; transform: translate(-260px, 150px); }
  6% { opacity: .9; }
  50% { transform: translate(420px, 70px); }
  94% { opacity: .9; }
  100% { opacity: 0; transform: translate(1120px, 120px); }
}

/* ---------- face 2: contact over the blurred sea ---------- */
/* only sky + sea of the clip (rows 0-53.6 %: no sand), as in the approved prototype; the blur hides the enlargement */
.sea-video { position: absolute; left: -40px; top: -40px; height: calc(100vh / .536 + 40px); width: auto; min-width: calc(100% + 80px); aspect-ratio: 1280 / 704;
  object-fit: cover; object-position: 0 0; filter: blur(16px) brightness(.75) saturate(1.1); transform: scale(1.08); transform-origin: 0 0; }
.veil { position: absolute; inset: 0; background: rgba(5, 18, 28, .25); }   /* "Mer nette": the sea stays clear and blue */
.card { position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 120px); overflow-y: auto; padding: 32px 34px 28px; border-radius: 18px; color: #fff;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .28); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  backdrop-filter: blur(14px) saturate(1.2); }
/* title in the welcome line's font (Erkan); fields, labels and button in Pagella */
.card h2 { font-family: "Cormorant Garamond", "Pagella", Georgia, serif; font-weight: 500; font-size: 2.6rem; line-height: 1.1; margin: 8px 0 18px; }
.card .eyebrow { opacity: .92; }
.note { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 1rem; color: #fff; }
.note.ok { background: rgba(80, 170, 110, .28); border: 1px solid rgba(160, 230, 180, .55); }
.note.err { background: rgba(190, 60, 40, .3); border: 1px solid rgba(255, 170, 150, .6); }
.fl { position: relative; display: block; margin: 0 0 16px; }
.fl input, .fl textarea { width: 100%; font: inherit; font-size: 1.22rem; color: #fff; background: transparent; border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .55); padding: 22px 2px 8px; outline: none; resize: none; min-height: 48px; }
.fl textarea { min-height: 78px; field-sizing: content; max-height: 40vh; }
.fl span { position: absolute; left: 2px; top: 21px; font-size: 1.15rem; opacity: .85; transition: transform .2s, font-size .2s, opacity .2s; pointer-events: none; }
.fl input:focus + span, .fl input:not(:placeholder-shown) + span,
.fl textarea:focus + span, .fl textarea:not(:placeholder-shown) + span { transform: translateY(-20px); font-size: .9rem; opacity: 1; letter-spacing: .06em; }
.fl input:focus, .fl textarea:focus { border-bottom-color: #fff; }
.fl.bad input, .fl.bad textarea { border-bottom: 2px solid #ffb4a0; }
.fl.bad span { color: #ffd0c2; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.card button { margin-top: 6px; font: inherit; font-size: 1.1rem; letter-spacing: .12em; text-transform: uppercase; color: #0c1820;
  background: #fff; border: 0; border-radius: 999px; padding: 12px 30px; cursor: pointer; }
.card button:hover, .card button:focus-visible { background: #e6eef2; }

/* ---------- small controls ---------- */
.dots { position: fixed; z-index: 4; right: 36px; top: 50%; transform: translateY(-50%); display: grid; gap: 10px; }
.dots span { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink); }
.face-1 .dots span:first-child, .face-2 .dots span:last-child { background: var(--ink); }
.face-2 .dots span { border-color: #fff; }
.face-2 .dots span:last-child { background: #fff; }
.face-2 .sound { color: #fff; filter: none; }
.sound { position: fixed; z-index: 5; right: 40px; bottom: 30px; width: 46px; height: 38px; padding: 4px; border: 0; background: transparent;
  color: var(--ink); cursor: pointer; filter: drop-shadow(0 0 4px var(--paper-fill)); }
.sound svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sound .arc { opacity: 0; transition: opacity .3s; }
.sound .mute { stroke-width: 1.5; transition: opacity .3s; }
.sound[aria-pressed="true"] .arc { opacity: 1; }
.sound[aria-pressed="true"] .mute { opacity: 0; }
.sound[aria-pressed="true"] .a2 { animation: swell 3s ease-in-out infinite; }
@keyframes swell { 50% { opacity: .3; } }
.sound:hover, .sound:focus-visible { color: var(--ink-hover); outline: none; }
html:not(.js) .sound { display: none; }   /* the sound needs JavaScript */

/* labels with a second position for portrait phones (Home.php $cap) */
.only-m { display: none; }
.cap-end { text-anchor: end; }

/* ---------- phones ---------- */
/* The boat is drawn 1.6x wider than the screen's drawing box: the hull (x 38-520 of the -70..810 viewBox) fills ~86 %
   of the width and its middle (x 279 = 39.66 % of the box) sits on the screen's middle; centred vertically too.
   Labels that would fall off the right side use their phone positions (.only-m). */
@media (max-width: 720px) and (orientation: portrait) {
  :root { --bw: 157vw; --bt: max(calc((100svh - var(--bh)) / 2), 22svh); }
  .boat { transform: translateX(-39.66%); }
  .only-w { display: none; }
  .only-m { display: inline; }
  .chart-frame { inset: 8px; }
  .logo { left: 22px; top: 20px; }
  .logo img { height: 42px; }
  .hero { top: 11vh; }
  .cap { font-size: 27px; }
  .cap-part { display: none; }
  .face-2 .boat { top: 2vh; transform: translateX(-100%) scale(.21); }   /* same size as before: .34 x 98/157 */
  .face-2 .boat:hover, .face-2 .boat:focus-within { transform: translateX(-100%) scale(.39); }
  .card { padding: 24px 22px 20px; top: 56%; }
  .card h2 { font-size: 2.15rem; }
  .dots { right: auto; left: 50%; top: auto; bottom: 30px; transform: translateX(-50%); grid-auto-flow: column; }   /* off the big boat */
  .sound { right: 22px; bottom: 22px; }
}

/* ---------- phones held sideways (short, wide screens) ---------- */
/* svh = the height left visible WITH the browser's toolbars: 100vh counts the area behind the address bar, which on a
   sideways phone pushed the lower labels under the bottom frame (Erkan's phone, 19-10-2026). */
/* Height is the limit here: the welcome lines move inside the frame, the boat fills the height between them and the
   bottom frame, labels show only the page names (bigger), and the corner decorations that hit the frame or the sound
   button are left out. */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --bh: calc(100svh - 118px); --bw: calc(var(--bh) / .5909); --bt: 84px; }
  .logo { top: 30px; }
  .logo img { height: 40px; }
  .hero { top: 34px; }
  .hero .eyebrow { font-size: .7rem; }
  .hero h1 { font-size: 1.6rem; }
  .cap { font-size: 40px; }   /* page names only: shorter than the wide-screen labels, so they can be bigger */
  .cap-part { display: none; }
  .c-cart, .c-rose { display: none; }
  /* contact card in two columns so the whole form fits the short screen: name + e-mail | message, button under it */
  .card { top: calc(50% + 12px); width: min(700px, calc(100vw - 260px)); max-height: calc(100svh - 40px); padding: 16px 26px 14px;
    display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; align-content: start; }
  .card .eyebrow, .card h2, .card .note { grid-column: 1 / -1; }
  .card h2 { font-size: 1.7rem; margin: 2px 0 4px; }
  .card .fl { margin-bottom: 8px; }
  .card .fl:nth-of-type(1) { grid-column: 1; grid-row: 3; }
  .card .fl:nth-of-type(2) { grid-column: 1; grid-row: 4; }
  .card .fl:nth-of-type(3) { grid-column: 2; grid-row: 3 / span 2; }
  .card .fl textarea { min-height: 96px; max-height: 30vh; }
  .card button { grid-column: 2; justify-self: end; margin-top: 2px; }
  .card:has(.note) .fl:nth-of-type(1) { grid-row: 4; }      /* a sent/error note takes row 3 */
  .card:has(.note) .fl:nth-of-type(2) { grid-row: 5; }
  .card:has(.note) .fl:nth-of-type(3) { grid-row: 4 / span 2; }
  .card .note { margin-bottom: 8px; padding: 6px 10px; }
}

/* ---------- visitors who switch animations off ---------- */
@media (prefers-reduced-motion: reduce) {
  .ready .boat { transition: none; }      /* no cube turn either: home.js switches faces directly */
  .rock, .ink.flag, .gull, .sound[aria-pressed="true"] .a2 { animation: none; }
  .ink, .fade, .cap { animation: none; stroke-dashoffset: 0; opacity: 1; }
  .ink.ghost { opacity: .45; }
  .gull { opacity: 0; }
  .hero h1 { transition: none; }
}

/* ---------- night (theme.js puts html.night / html.day from the visitor's clock, 19-10-2026) ---------- */
/* The same chart by moonlight: blue-black parchment (the paper texture stays), cream ink, the lighthouse sweeping its
   beam, stars and a crescent moon on the chart's own coordinates (.night-sky), a lantern on the mast. */
.night-only, .logo .logo-night, .lantern, .theme .i-sun { display: none; }   /* .logo img {display:block} must not win */
html.night .night-only { display: inline; }
html.night .day-only { display: none; }
html.night .logo .logo-night { display: block; }
html.night .logo .logo-day { display: none; }
html.night {
  --ink: #eadfc6;
  --ink-hover: #ffd58a;
  --paper: #0d1726;
  --paper-fill: #13213a;
}
html.night .paperbg { filter: brightness(.3) saturate(.75) hue-rotate(185deg); }
html.night .c-light path { fill: #ffe9b0; }
html.night .c-light .c-flare { fill: rgba(255, 222, 150, .45); }
/* the boat at night is a pure line drawing (Erkan, 19-10): no fill — the night chart shows through hull and sails —
   white lines; the part under the pointer glows warm and turns gold like its caption */
html.night .boat .hullfill, html.night .boat .wash { fill: transparent; }
html.night .boat .ink:not(.lead):not(.wave-line), html.night .boat .dash, html.night .boat .hatchline { stroke: #f8f4ea; }
html.night .boat a.part:hover .wash, html.night .boat a.part:focus-visible .wash { fill: rgba(255, 214, 140, .2); }
html.night .boat a.part:hover .ink, html.night .boat a.part:focus-visible .ink,
html.night .boat a.part:hover .dash, html.night .boat a.part:focus-visible .dash { stroke: var(--ink-hover); }
/* no halo around the letters at night (it showed as a bluish outline) */
html.night .cap { stroke: none; }
html.night .hero h1 { text-shadow: none; }
html.night .gulls, html.night .birds { display: none; }   /* no gulls at night (flying + the two in the boat sketch) */
html.night .lantern { display: inline; }
html.night .logo { filter: drop-shadow(0 0 6px var(--paper-fill)) drop-shadow(0 0 14px var(--paper-fill)); }
/* contact face: only the sea behind the card gets darker (the poster is the face's own background: the veil covers it) */
html.night .sea-video { filter: blur(16px) brightness(.42) saturate(.85); }   /* same blur as by day, only darker */
html.night .veil { background: rgba(2, 10, 24, .5); }
/* the small boat sits on a light card there: it keeps the day's dark ink, and no lantern */
html.night .face-2 .boat { --ink: #221e18; --ink-hover: #8b5a1c; --paper-fill: #e9d6b3; }
html.night .face-2 .lantern { display: none; }
html.night .face-2 .boat .hullfill, html.night .face-2 .boat .wash { fill: #fbf7ee; }
html.night .face-2 .boat .ink:not(.lead):not(.wave-line), html.night .face-2 .boat .dash, html.night .face-2 .boat .hatchline { stroke: var(--ink); }

.night-sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0; transition: opacity 2s; }
html.night .night-sky { opacity: 1; }
.beam { transform-box: fill-box; transform-origin: 0% 50%; animation: sweep 14s linear infinite; mix-blend-mode: screen; }
@keyframes sweep { to { transform: rotate(360deg); } }
.lamp { animation: lamp 14s linear infinite; }
@keyframes lamp { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.stars circle { fill: #f6ecd2; opacity: .55; animation: twinkle 5s ease-in-out infinite; }
.stars circle:nth-child(3n) { animation-duration: 7s; animation-delay: -2s; }
.stars circle:nth-child(4n+1) { animation-duration: 4s; animation-delay: -3s; }
@keyframes twinkle { 0%, 100% { opacity: .2; } 50% { opacity: .8; } }
.moon-face { fill: #f3e7c6; }
.moon-phone { display: none; }
.lantern-core { fill: #fff4c8; }
.lantern-glow { animation: flicker 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes flicker { 0%, 100% { opacity: .9; transform: scale(1); } 30% { opacity: .65; transform: scale(.9); } 55% { opacity: 1; transform: scale(1.06); } 80% { opacity: .75; } }

/* while the clock or the button switches, colours fade instead of jumping (home.js adds .theme-fade for 1.8 s) */
html.theme-fade .paperbg, html.theme-fade .chart *, html.theme-fade .boat svg *, html.theme-fade .hero, html.theme-fade .chart-frame,
html.theme-fade .chart-frame::before, html.theme-fade .chart-frame::after, html.theme-fade .sound, html.theme-fade .theme {
  transition: fill 1.6s, stroke 1.6s, color 1.6s, border-color 1.6s, filter 1.6s, opacity 1.6s; }

/* the ☀ / ☾ button, left of the sound button */
.theme { position: fixed; z-index: 5; right: 96px; bottom: 30px; width: 38px; height: 38px; padding: 5px; border: 0; background: transparent;
  color: var(--ink); cursor: pointer; opacity: .85; }
.theme svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme .i-moon { fill: currentColor; fill-opacity: .15; }
html.night .theme .i-moon { display: none; }
html.night .theme .i-sun { display: inline; }
.theme:hover, .theme:focus-visible { color: var(--ink-hover); opacity: 1; outline: none; }
.face-2 .theme { color: #fff; }
html:not(.js) .theme { display: none; }

@media (max-width: 720px) {
  .theme { right: 74px; bottom: 22px; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .moon-wide { display: none; }
  .moon-phone { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .beam { animation: none; transform: rotate(-20deg); }
  .lamp, .stars circle, .lantern-glow { animation: none; }
}
