/* Kipin M7 — /capitaine: the captain's cabin on the parchment. The picture (.stage) carries the face pieces, sea, smoke
   and the hidden objects in % of the picture; the dialogue (.talk) sits beside it on wide screens, below it otherwise.
   Night (html.night from theme.js): the night picture + the home page's moonlit colours. */
@font-face { font-family: "Pagella"; src: url(../home/fonts/texgyrepagella-regular.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Pagella"; font-style: italic; src: url(../home/fonts/texgyrepagella-italic.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap;
  src: url(../home/fonts/cormorant-garamond-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Logbook"; src: url(../home/fonts/texgyrechorus-mediumitalic.woff2) format("woff2"); font-display: swap; }

:root { --ink: #221e18; --ink-hover: #8b5a1c; --paper: #e4cfa8; --paper-fill: #e9d6b3; --note: rgba(250, 243, 226, .9); }
html.night { --ink: #eadfc6; --ink-hover: #ffd58a; --paper: #19232e; --paper-fill: #055570; --note: rgba(5, 85, 112, .94); }   /* Erkan 20-10: teal night */
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: "Pagella", Georgia, serif; line-height: 1.5;
  background: var(--paper) url(../home/paper.jpg) center / cover fixed;
  background-image: image-set(url(../home/paper.webp) type("image/webp"), url(../home/paper.jpg) type("image/jpeg")); }
html.night body { background: #19232e; }   /* flat at night, no parchment texture (Erkan 20-10) */
.frame { position: fixed; inset: 14px; z-index: 0; pointer-events: none; border: 1.4px solid var(--ink); opacity: .8; }
.frame::after { content: ""; position: absolute; inset: 10px; border: .7px solid var(--ink); }

.captain { position: relative; z-index: 1; width: min(1600px, 100%); min-height: 100vh; margin: 0 auto; padding: 22px clamp(18px, 3vw, 44px) 40px;
  display: flex; flex-direction: column; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 6px 14px; }
.logo img { display: block; height: clamp(46px, 7vh, 64px); width: auto; }
.logo .logo-night, html.night .logo .logo-day { display: none; }
html.night .logo .logo-night { display: block; }
.back { color: var(--ink); text-decoration: none; font-style: italic; font-size: 1.1rem; }
.back:hover, .back:focus-visible { color: var(--ink-hover); text-decoration: underline; text-underline-offset: 4px; }

/* layout: picture + dialogue side by side on wide screens */
.cabin { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1fr); gap: 28px; align-items: center; margin: auto 0; padding-bottom: 30px; }
/* page title over the picture, in the home page's heading face */
.heading { margin: 0 0 14px; text-align: center; font-family: "Cormorant Garamond", "Pagella", Georgia, serif; font-weight: 500;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem); line-height: 1.1; letter-spacing: .01em; }
.stage-wrap { border-radius: 4px; overflow: hidden; box-shadow: 0 14px 40px rgba(70, 45, 10, .25); }
.stage { position: relative; aspect-ratio: 2048 / 1143; }
.scene, .scene img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene { transition: opacity .9s, visibility .9s; }
.scene.night, html.night .scene.day { opacity: 0; visibility: hidden; }
html.night .scene.night { opacity: 1; visibility: visible; }

.piece { position: absolute; display: block; opacity: 0; pointer-events: none; }
.piece.on { opacity: 1; }
.mouth { transition: opacity 110ms ease-in-out; }
.piece.night, html.night .piece.day { display: none; }
html.night .piece.night { display: block; }
.eyes { left: 48.328%; top: 21.484%; width: 10.174%; height: 6.836%; }
.mouth { left: 49.782%; top: 30.469%; width: 7.994%; height: 9.245%; }
.sea, .smoke { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lamp-glow { position: absolute; left: 8.07%; top: 39.06%; width: 30%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(circle, rgba(255, 196, 110, .55), rgba(255, 170, 80, .18) 38%, transparent 70%); }
html.night .lamp-glow { mix-blend-mode: screen; background: radial-gradient(circle, rgba(255, 190, 100, .45), rgba(255, 150, 60, .12) 40%, transparent 70%); }
.needle { position: absolute; left: 14.9%; top: 88.5%; width: 7%; transform: translate(-50%, -50%); opacity: 0; pointer-events: none;
  transition: opacity .4s; }
.needle.on { opacity: .9; }
.needle .n { fill: #8b2a1c; } .needle .s { fill: #e9dcc0; stroke: #221e18; stroke-width: 1.5; } .needle circle { fill: #221e18; }

/* hidden objects: invisible buttons over the picture (a soft glow on hover / keyboard focus) */
.spot { position: absolute; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 50%; }
.spot:hover, .spot:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(255, 214, 140, .0), 0 0 30px 6px rgba(255, 214, 140, .28); }
.spot.lamp { left: 3.6%; top: 11.7%; width: 13.4%; height: 41.7%; border-radius: 40%; }
.spot.compass { left: 5.5%; top: 67.7%; width: 14.5%; height: 29%; }
.spot.logbook { left: 24%; top: 79.4%; width: 42%; height: 19.8%; border-radius: 30%; }
.spot.beard { left: 46%; top: 31%; width: 11%; height: 16%; }

/* dialogue */
.talk { display: flex; flex-direction: column; gap: 16px; }
.bubble { position: relative; padding: 20px 24px 18px; border-radius: 16px; background: var(--note); border: 1.5px solid var(--ink);
  box-shadow: 0 6px 18px rgba(40, 25, 10, .18); min-height: 7.5em; }
.bubble::before { content: ""; position: absolute; left: -15px; top: 30%; border: 9px solid transparent; border-right: 15px solid var(--ink); border-left: 0; }
.voice { float: right; margin: -6px -8px 6px 12px; font: inherit; font-size: .95rem; color: var(--ink); background: transparent;
  border: 1px solid var(--ink); border-radius: 20px; padding: 4px 12px; cursor: pointer; opacity: .85; }
.voice:hover, .voice:focus-visible { opacity: 1; color: var(--ink-hover); border-color: var(--ink-hover); outline: none; }
.voice .v-on, .voice[aria-pressed="true"] .v-off { display: none; }
.voice[aria-pressed="true"] .v-on { display: inline; }
.say { margin: 0; font-size: clamp(1.05rem, 1.35vw, 1.3rem); font-style: italic; min-height: 3em; white-space: pre-line; }
.skip { position: absolute; right: 12px; bottom: 8px; border: 0; background: none; color: var(--ink); opacity: .65; font: inherit;
  font-size: .9rem; cursor: pointer; }
.skip:hover, .skip:focus-visible { opacity: 1; text-decoration: underline; }
.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.choices button, .choices a { font-family: "Logbook", "Pagella", serif; font-size: 1.15rem; line-height: 1.2; color: var(--ink);
  text-decoration: none; background: var(--note); border: 1px solid var(--ink); border-radius: 3px 10px 3px 10px; padding: 8px 14px;
  cursor: pointer; transform: rotate(-.6deg); box-shadow: 1px 2px 0 rgba(34, 30, 24, .25); transition: transform .15s, box-shadow .15s; }
.choices > :nth-child(even) { transform: rotate(.7deg); }
.choices button:hover, .choices a:hover, .choices button:focus-visible, .choices a:focus-visible {
  outline: none; color: var(--ink-hover); border-color: var(--ink-hover); transform: rotate(0) translateY(-1px); box-shadow: 2px 4px 0 rgba(34, 30, 24, .3); }
.choices .answer-right { border-color: #3d7a3a; color: #2d6a2a; }
.choices .answer-wrong { opacity: .5; text-decoration: line-through; }

/* footer, as on the other parchment pages (at the bottom of the page) */
.foot { padding: 6px 16px 4px; text-align: center; font-style: italic; font-size: .95rem; opacity: .8; }
.foot a { color: var(--ink); }
.foot a:hover, .foot a:focus-visible { color: var(--ink-hover); }

/* logbook panel */
.log { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(20, 12, 4, .45); }
.log[hidden] { display: none; }
.log-page { width: min(520px, calc(100vw - 32px)); max-height: 80vh; overflow: auto; padding: 26px 30px; border-radius: 4px;
  background: var(--paper-fill) url(../home/paper.jpg) center / cover; border: 1px solid var(--ink); color: #221e18;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.log-page h2 { margin: 0 0 4px; font-family: "Logbook", serif; font-weight: 400; font-size: 2rem; }
.log-hint { margin: 0 0 14px; font-style: italic; opacity: .75; }
.log-list { margin: 0 0 18px; padding-left: 1.4em; }
.log-list button { font: inherit; font-size: 1.1rem; background: none; border: 0; padding: 4px 0; color: #221e18; cursor: pointer; text-align: left; }
.log-list button:hover, .log-list button:focus-visible { color: #8b5a1c; text-decoration: underline; }
.log-close { font: inherit; border: 1px solid #221e18; border-radius: 6px; background: transparent; padding: 6px 14px; cursor: pointer; }

/* sound + day / night buttons, as on the home page */
.theme, .sound { position: fixed; z-index: 5; bottom: 30px; width: 40px; height: 40px; padding: 5px; border: 0; background: transparent;
  color: var(--ink); cursor: pointer; opacity: .8; }
.theme { right: 96px; } .sound { right: 44px; }
.theme:hover, .sound:hover, .theme:focus-visible, .sound:focus-visible { opacity: 1; color: var(--ink-hover); outline: none; }
.theme svg, .sound 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; }
.theme .i-sun, html.night .theme .i-moon { display: none; }
html.night .theme .i-sun { display: inline; }
.sound path:first-child { fill: currentColor; fill-opacity: .15; }
.sound .arc { display: none; } .sound[aria-pressed="true"] .arc { display: inline; } .sound[aria-pressed="true"] .mute { display: none; }

/* below the picture on narrower screens; phones zoom on the captain */
@media (max-width: 1100px) {
  .cabin { grid-template-columns: 1fr; gap: 18px; }
  .bubble::before { left: 50%; top: -15px; border: 9px solid transparent; border-bottom: 15px solid var(--ink); border-top: 0; transform: translateX(-50%); }
}
@media (max-width: 640px) {
  .heading { margin-bottom: 10px; }
  .frame { inset: 8px; }
  .captain { padding: 16px 12px 90px; }
  .top { padding: 2px 4px 10px; }
  .stage-wrap { aspect-ratio: 1 / .95; }
  .stage { width: 170%; margin-left: -43%; }
  .choices button, .choices a { font-size: 1.05rem; }
  .theme, .sound { bottom: 18px; } .theme { right: 70px; } .sound { right: 22px; }
}
@media (prefers-reduced-motion: reduce) { .scene, .mouth, .needle { transition: none; } }
