/* ============================================================
   Spisereiskap for born — P1
   Two deliberate layouts:
     • Landscape  → faithful poster reconstruction
     • Portrait   → re-flowed mobile reading layout
   ============================================================ */

:root {
  --paper:      #efece4;
  --paper-2:    #e9e5db;
  --ink:        #1b1a16;
  --ink-soft:   #4a4842;
  --ink-mute:   #87837a;
  --line:       #cfc9bc;
  --line-soft:  #ddd8cc;
  --draw:       #8b9099;   /* technical line-drawing stroke */
  --dot:        #1b1a16;
  --accent:     #1b1a16;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #ddd9cf;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ------------------------------------------------------------
   SHEET — the poster surface
   ------------------------------------------------------------ */
.sheet {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
}

/* thin inner frame line, just like the printed board */
.sheet::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid var(--line);
  pointer-events: none;
  z-index: 5;
}

/* ------------------------------------------------------------
   Left vertical metadata line
   ------------------------------------------------------------ */
.meta-side {
  position: absolute;
  left: 22px;
  top: 28px;
  bottom: 28px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-transform: uppercase;
  z-index: 6;
}
.meta-item { white-space: nowrap; }

/* ------------------------------------------------------------
   Topbar — running header
   ------------------------------------------------------------ */
.topbar {
  position: absolute;
  top: 30px;
  left: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  z-index: 6;
}
.topbar-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink);
  display: inline-block;
}

/* page switcher */
.pagenav {
  display: flex;
  gap: 18px;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}
.pagenav a {
  color: var(--ink-mute);
  text-decoration: none;
  letter-spacing: 0.16em;
  transition: color 0.15s ease;
}
.pagenav a:hover { color: var(--ink-soft); }
.pagenav a.is-active { color: var(--ink); }
.pagenav a.is-active::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--ink);
  vertical-align: middle;
}

/* ------------------------------------------------------------
   LAYOUT — two columns on the poster
   ------------------------------------------------------------ */
.layout {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(20px, 3vw, 56px);
  padding: clamp(64px, 9vh, 110px) clamp(48px, 6vw, 96px) clamp(40px, 6vh, 80px) 64px;
}

/* Tommel — three zones: text · model · drawings */
.sheet--tommel .layout {
  grid-template-columns: 0.92fr 0.96fr 0.78fr;
  align-items: stretch;
}

/* Tunge — text top-left, model bottom-left, drawings full-height right */
.sheet--tunge .layout {
  grid-template-columns: 1.08fr 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "content drawings"
    "stage   drawings";
}
.sheet--tunge .content  { grid-area: content; }
.sheet--tunge .stage    { grid-area: stage; }
.sheet--tunge .drawings { grid-area: drawings; }

/* ---- left text column ---- */
.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.title {
  margin: 0 0 clamp(14px, 2vh, 26px);
  font-weight: 800;
  font-size: clamp(54px, 8vw, 104px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.body {
  max-width: 46ch;
}
.body p {
  margin: 0 0 14px;
  font-size: clamp(13px, 1.05vw, 15.5px);
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---- specs ---- */
.specs {
  margin: clamp(18px, 3vh, 40px) 0 0;
  max-width: 360px;
}
.spec-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.spec-row:last-child { border-bottom: 1px solid var(--line-soft); }
.spec-row dt { margin: 0; font-weight: 600; color: var(--ink); }
.spec-row dd { margin: 0; color: var(--ink-soft); }

/* ---- technical line drawings ---- */
.drawings {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  gap: clamp(18px, 3vw, 44px);
  align-items: flex-end;
}
.drawing { height: clamp(110px, 16vh, 168px); width: auto; }
.drawing .ln {
  stroke: var(--draw);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}
.drawing .fill { fill: url(#hatch); }
.drawing .hatch { stroke: var(--draw); stroke-width: 1; opacity: 0.55; }

/* ---- Tommel / Tunge blueprint drawings ---- */
.drawings--tommel,
.drawings--tunge {
  margin-top: 0;
  padding-top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vh, 40px);
}
.dwg { margin: 0; }
.dwg svg { display: block; width: auto; }
.dwg-elevation svg { height: clamp(260px, 48vh, 430px); }
.dwg-section   svg { height: clamp(120px, 20vh, 175px); }
.dwg-top       svg { height: clamp(240px, 44vh, 380px); }
.dwg-profile   svg { height: clamp(96px, 18vh, 150px); }

.dwg .ln {
  stroke: var(--draw);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}
.dwg .ln.faint { stroke: var(--draw); opacity: 0.5; }
.dwg .rille { stroke-width: 1; opacity: 0.6; }
.dwg .grid line { stroke: #9fb6cf; stroke-width: 1; opacity: 0.55; }

.dwg .dim line {
  stroke: var(--ink-soft);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}
.dwg .dim text {
  fill: var(--ink-soft);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.dwg .caption {
  fill: var(--ink-soft);
  font-family: var(--font);
  font-size: 11px;
  letter-spacing: 0.18em;
}

/* ------------------------------------------------------------
   STAGE — 3D model + callouts
   ------------------------------------------------------------ */
.stage {
  position: relative;
  min-width: 0;
}
.viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  --poster-color: transparent;
  background: transparent;
}

/* callouts: dot + connector + label, positioned over the stage */
.callouts {
  list-style: none;
  margin: 0;
  padding: 0;
}
.callout {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 168px;
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  z-index: 4;
}
.callout-text { padding-top: 1px; }
.callout-dot {
  position: relative;
  flex: 0 0 auto;
  width: 9px; height: 9px;
  margin-top: 3px;
  border: 1.4px solid var(--dot);
  border-radius: 50%;
  background: transparent;
}
/* connector line drawn from the dot toward the model (to the left) */
.callout-dot::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: 38px;
  height: 1px;
  background: var(--dot);
  transform: translateY(-50%);
}

/* place the three callouts down the right edge of the stage */
.callout--1 { top: 14%;  right: -2%; }
.callout--2 { top: 47%;  right: -4%; }
.callout--3 { top: 76%;  right: 4%;  }

/* ============================================================
   PORTRAIT  /  MOBILE  — re-flowed reading layout
   ============================================================ */
@media (orientation: portrait), (max-width: 760px) {
  html, body { background: var(--paper); }

  .sheet {
    min-height: 100vh;
    min-height: 100dvh;
  }
  .sheet::after { inset: 10px; }

  .meta-side {
    /* becomes a single quiet line pinned to the very bottom */
    position: static;
    writing-mode: horizontal-tb;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    padding: 22px 24px 30px;
    font-size: 9.5px;
    letter-spacing: 0.12em;
    order: 99;
  }
  .meta-item { position: relative; }
  .meta-item + .meta-item::before {
    content: "·";
    margin-right: 16px;
    color: var(--ink-mute);
  }

  .topbar {
    position: static;
    flex-wrap: wrap;
    row-gap: 12px;
    padding: 26px 24px 0;
    font-size: 11px;
  }
  .pagenav {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    width: 100%;
    gap: 22px;
  }

  .layout {
    position: static;
    display: flex;
    flex-direction: column;
    inset: auto;
    padding: 14px 24px 0;
    gap: 0;
  }

  /* model first as a hero, then the writing, then drawings */
  .stage    { order: 1; }
  .content  { order: 2; }
  .drawings { order: 3; }

  /* reset desktop grid placement so the flex column order wins */
  .sheet--tunge .content,
  .sheet--tunge .stage,
  .sheet--tunge .drawings { grid-area: auto; }

  .drawings--tommel,
  .drawings--tunge {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 28px;
    margin: 30px 0 8px;
  }
  .dwg-elevation svg, .dwg-top svg { height: 240px; }
  .dwg-section svg, .dwg-profile svg { height: 140px; }

  .title {
    font-size: clamp(46px, 18vw, 76px);
    margin: 10px 0 18px;
  }

  .stage {
    position: relative;
    height: auto;
    margin: 6px 0 4px;
  }
  /* model becomes an in-flow hero; callouts then flow below it */
  .viewer {
    position: relative;
    inset: auto;
    height: 46vh;
    height: 46dvh;
    min-height: 300px;
  }

  /* on mobile the callouts read better as a clean list under the model */
  .callouts {
    position: static;
    margin: 14px 0 0;
    display: grid;
    gap: 0;
  }
  .callout {
    position: static;
    max-width: none;
    padding: 10px 0;
    border-top: 1px solid var(--line-soft);
    font-size: 12.5px;
  }
  .callout:last-child { border-bottom: 1px solid var(--line-soft); }
  .callout-dot::before { display: none; }
  .callout-dot {
    width: 7px; height: 7px;
    background: var(--dot);
    margin-top: 4px;
  }

  .body { max-width: none; }
  .body p { font-size: 14.5px; }

  .specs { max-width: none; margin-top: 26px; }
  .spec-row { grid-template-columns: 128px 1fr; font-size: 13px; }

  .drawings {
    margin: 30px 0 8px;
    padding-top: 0;
    justify-content: flex-start;
    gap: 32px;
  }
  .drawing { height: 150px; }
}

/* a touch more breathing room on very small phones */
@media (max-width: 380px) {
  .topbar { letter-spacing: 0.1em; }
  .spec-row { grid-template-columns: 108px 1fr; }
}

/* ============================================================
   LANDSCAPE on short viewports (phones turned sideways)
   keep the poster proportions but tighten paddings
   ============================================================ */
@media (orientation: landscape) and (max-height: 560px) {
  .layout {
    padding: 54px clamp(36px, 5vw, 80px) 30px 56px;
  }
  .title { font-size: clamp(40px, 7vw, 72px); }
  .body p { font-size: 12px; }
  .specs { margin-top: 14px; }
  .drawing { height: clamp(80px, 22vh, 120px); }
}
