/* =========================================================
   Interactive page: A tűzháromszög (fire triangle)
   Its own look, different from the landing page on purpose:
   Escher-style impossible geometry, faded stone and pastel tones, pencil marks,
   Josefin Sans + Space Mono, and a faint photo of the selected fuel in the background.
   Loaded after style.css (which provides the skip link and the language switch).
   ========================================================= */

.ft-body {
  /* faded, pastel accents */
  --ft-heat: #e3a593;
  --ft-oxygen: #a3d0da;
  --ft-fuel: #cdb390;
  /* coloured pencils for marks drawn on the beams (chosen to read on each beam's outer face) */
  --pencil-heat: #a9553f;
  --pencil-oxygen: #2c6f80;
  --pencil-fuel: #f0dfc2;
  --pencil-graphite: #3d3b38;
  --ft-ok: #a9d6b2;
  --ft-bad: #e6aaa2;
  --ft-ink: #0d0e12;
  --ft-paper: #e6e0d4;
  --ft-stone: #9a958c;
  --ft-font: 'Josefin Sans', ui-sans-serif, system-ui, sans-serif;
  --ft-mono: 'Space Mono', ui-monospace, 'SFMono-Regular', monospace;
  --ft-cut: 12px;

  background: var(--ft-ink);
  color: var(--ft-paper);
  font-family: var(--ft-font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* no starfield here */
.ft-body::before,
.ft-body::after {
  display: none;
}

/* ---------- background: fuel photo + tumbling-blocks pattern ---------- */
.ft-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(80% 70% at 40% 45%, #17181d 0%, var(--ft-ink) 100%);
}
.ft-bg__photo {
  position: absolute;
  inset: 0;
  background: center / cover no-repeat;
  filter: grayscale(0.6) sepia(0.25) contrast(1.05) brightness(0.8);
  opacity: 0;
  transition: opacity 1.2s ease;
}
.ft-bg__photo.is-active {
  opacity: 0.2;
}
.ft-bg__pattern {
  position: absolute;
  inset: 0;
  background: url('../img/escher-cubes.svg') 0 0 / 60px 103.92px repeat;
  -webkit-mask-image: radial-gradient(85% 75% at 40% 50%, transparent 25%, #000 85%);
  mask-image: radial-gradient(85% 75% at 40% 50%, transparent 25%, #000 85%);
}

/* ---------- slim header and footer ---------- */
.ft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px clamp(12px, 3vw, 24px);
  border-bottom: 1px solid rgba(230, 224, 212, 0.08);
  background: rgba(13, 14, 18, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ft-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ft-paper);
  font: 600 1rem/1 var(--ft-font);
  letter-spacing: 0.04em;
  text-decoration: none;
}
.ft-brand span {
  padding-top: 3px; /* Josefin Sans sits high */
}
.ft-brand:hover {
  color: #ffffff;
}
.ft-lang {
  padding: 2px;
}
.ft-lang .lang-switch__btn {
  min-height: 26px;
  padding: 4px 10px;
  font-family: var(--ft-mono);
}

.ft-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  padding: 5px 16px;
  border-top: 1px solid rgba(230, 224, 212, 0.08);
  color: rgba(230, 224, 212, 0.45);
  font: 400 0.72rem/1.4 var(--ft-mono);
}
.ft-footer a {
  color: rgba(230, 224, 212, 0.6);
}

/* ---------- layout: triangle in the free space, all the info on the right ---------- */
.ft-main {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 14px;
  padding: 12px clamp(12px, 3vw, 24px);
  grid-template-columns: minmax(0, 1fr);
}
.ft-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.ft-stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
}
@media (min-width: 900px) and (min-height: 560px) {
  .ft-body {
    height: 100vh;
    height: 100svh;
    overflow: hidden;
  }
  .ft-main {
    grid-template-columns: minmax(0, 1fr) minmax(270px, 330px);
  }
  .ft-panel {
    justify-content: center;
  }
}
/* narrow screens: one column, the triangle right under the title */
@media (max-width: 899px), (max-height: 559px) {
  .ft-panel {
    display: contents;
  }
  .ft-title {
    order: 0;
  }
  .ft-stage-wrap {
    order: 1;
  }
  .ft-status {
    order: 2;
  }
  .ft-card--heat {
    order: 3;
  }
  .ft-card--oxygen {
    order: 4;
  }
  .ft-card--fuel {
    order: 5;
  }
}

/* ---------- title with an "extruded", isometric look ---------- */
.ft-title {
  font: 700 clamp(1.15rem, 1.65vw, 1.5rem) / 1.1 var(--ft-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ft-paper);
  text-shadow:
    1px 1px 0 #8d8880,
    2px 2px 0 #6e6a63,
    3px 3px 0 #4f4b46,
    4px 4px 0 #3a3733,
    6px 7px 12px rgba(0, 0, 0, 0.6);
}

/* ---------- the stage (Penrose triangle, flame, pencil marks, sliders) ---------- */
.ft-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 600px;
  height: 540px;
  transform-origin: 0 0;
}
.ft-svg {
  position: absolute;
  inset: 0;
  width: 600px;
  height: 540px;
  overflow: visible;
  pointer-events: none;
}
.ft-svg--marks {
  z-index: 1; /* scale and pencil marks stay readable above the flame */
}
.ft-face {
  stroke: #1d1d21;
  stroke-width: 1.2;
  stroke-linejoin: round;
}
.ft-face--plain {
  stroke: none;
}
.ft-face-edge {
  stroke: #1d1d21;
  stroke-width: 1.2;
  stroke-linecap: round;
}
.ft-face-tint {
  fill-opacity: 0.14;
  stroke: none;
}
.ft-tick {
  stroke: rgba(230, 224, 212, 0.5);
  stroke-width: 1.3;
}
.ft-tick--minor {
  stroke: rgba(230, 224, 212, 0.22);
}
.ft-tick-label {
  fill: rgba(230, 224, 212, 0.7);
  font: 400 13px var(--ft-mono);
}

/* pencil strokes (wobbly polylines, drawn twice, roughened by the #ft-pencil filter) */
.ft-pencil {
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.9;
}
.ft-pencil--second {
  stroke-width: 1;
  opacity: 0.55;
}
.ft-mark--ignition {
  stroke: var(--pencil-heat);
}
.ft-mark--limit {
  stroke: var(--pencil-oxygen);
}
.ft-mark--air {
  stroke: var(--pencil-graphite);
  stroke-dasharray: 3 4;
}
.ft-mark-label {
  font: 700 12px var(--ft-mono);
  stroke: none;
}
.ft-mark-label.ft-mark--ignition {
  fill: var(--ft-heat);
}
.ft-mark-label.ft-mark--limit {
  fill: var(--ft-oxygen);
}
.ft-handle--heat .ft-pencil {
  stroke: var(--pencil-heat);
}
.ft-handle--oxygen .ft-pencil {
  stroke: var(--pencil-oxygen);
}
.ft-handle--fuel .ft-pencil {
  stroke: var(--pencil-fuel);
}
.ft-pencil--handle {
  stroke-width: 2.2;
}
.ft-handle.is-focused .ft-pencil--handle {
  stroke-width: 3.4;
}
/* the handle: a pastel-filled pencil circle */
.ft-handle-fill {
  stroke: none;
  opacity: 0.95;
}
.ft-handle--heat .ft-handle-fill {
  fill: var(--ft-heat);
}
.ft-handle--oxygen .ft-handle-fill {
  fill: var(--ft-oxygen);
}
.ft-handle--fuel .ft-handle-fill {
  fill: var(--ft-fuel);
}

/* pointer targets: handles, the beams' outer faces with their scales, labelled ticks and limit marks */
.ft-hit,
.ft-handle-hit,
.ft-handle-fill,
.ft-mark-hit,
.ft-tick-label,
.ft-mark-label {
  pointer-events: all;
  cursor: pointer;
  touch-action: none;
}
.ft-hit,
.ft-handle-hit {
  fill: transparent;
  stroke: none;
}
.ft-handle-hit,
.ft-handle-fill {
  cursor: grab;
}
.ft-mark-hit {
  stroke: transparent;
  stroke-width: 12;
}
.ft-stage.is-dragging,
.ft-stage.is-dragging * {
  cursor: grabbing !important;
}
.ft-tick-label:hover,
.ft-mark-label:hover {
  text-decoration: underline;
}

.ft-flame {
  position: absolute;
  left: 0;
  top: 0;
  width: 600px;
  height: 540px;
  pointer-events: none;
}

/* native range inputs along the beams' centre lines: invisible, they take the pointer and the keyboard;
   what you see is the pencil drawing (placed and rotated by fire-triangle.js) */
.ft-slider {
  position: absolute;
  z-index: 2;
  height: 28px;
  margin: 0;
  padding: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  transform-origin: 50% 50%;
  pointer-events: none; /* the pointer works on the drawing (see .ft-hit, .ft-handle-*), the keyboard on these */
}
.ft-slider:focus {
  outline: none;
}
.ft-slider::-webkit-slider-runnable-track {
  height: 28px;
  background: transparent;
  border: none;
}
.ft-slider::-moz-range-track {
  height: 28px;
  background: transparent;
  border: none;
}
.ft-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -1px;
  border: none;
  border-radius: 50%;
  background: transparent;
}
.ft-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: transparent;
}

/* ---------- cards with cut corners (isometric feel) ---------- */
.ft-card,
.ft-status {
  position: relative;
  padding: 12px 16px 12px 18px;
  background: rgba(16, 17, 22, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  clip-path: polygon(var(--ft-cut) 0, 100% 0, 100% calc(100% - var(--ft-cut)), calc(100% - var(--ft-cut)) 100%, 0 100%, 0 var(--ft-cut));
  box-shadow: inset 3px 0 0 var(--accent, var(--ft-stone)), inset 0 0 0 1px rgba(230, 224, 212, 0.08);
}
.ft-card--heat {
  --accent: var(--ft-heat);
}
.ft-card--oxygen {
  --accent: var(--ft-oxygen);
}
.ft-card--fuel {
  --accent: var(--ft-fuel);
  min-height: 0;
  overflow: auto;
}
.ft-card__label {
  color: var(--accent);
  font: 700 0.72rem/1.2 var(--ft-font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.ft-card__value {
  margin: 3px 0 4px;
  color: #f4f0e8;
  font: 700 clamp(1.5rem, 2.2vw, 2rem) / 1.1 var(--ft-mono);
  letter-spacing: -0.03em;
}
.ft-card__value--name {
  font: 700 clamp(1.2rem, 1.7vw, 1.5rem) / 1.15 var(--ft-font);
  letter-spacing: 0.02em;
}
.ft-card__desc {
  color: rgba(230, 224, 212, 0.7);
  font-size: 0.85rem;
  line-height: 1.42;
}
.ft-card__need {
  margin-top: 5px;
  font-size: 0.84rem;
  line-height: 1.38;
}
.ft-card__state {
  margin-top: 3px;
  font-size: 0.84rem;
  line-height: 1.38;
  color: rgba(230, 224, 212, 0.6);
}
.ft-card__state[data-ok='yes'] {
  color: var(--ft-ok);
}
.ft-card__state[data-ok='no'] {
  color: var(--ft-bad);
}

.ft-status {
  --accent: var(--ft-bad);
}
.ft-status[data-state='burning'] {
  --accent: var(--ft-heat);
  background: linear-gradient(100deg, rgba(227, 165, 147, 0.14), rgba(16, 17, 22, 0.8) 60%);
}
.ft-status__title {
  font: 700 1.1rem/1.25 var(--ft-font);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.ft-status[data-state='burning'] .ft-status__title {
  color: #f3cfae;
}
.ft-status__hint {
  margin-top: 5px;
  color: rgba(230, 224, 212, 0.72);
  font-size: 0.85rem;
  line-height: 1.42;
}

@media (prefers-reduced-motion: reduce) {
  .ft-bg__photo {
    transition: none;
  }
}
