/* =============================================================
 * Foto Beregnere — styling
 * Selvstændig CSS, scoped under .fb så det ikke roder med temaet.
 * Stil: editorial / dark-room — varm accent, ren typografi.
 * ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;1,9..144,400&family=JetBrains+Mono:wght@400;500&display=swap');

.fb,
.fb * {
    box-sizing: border-box;
}

.fb {
    /* Tokens — scoped, så de ikke lækker. */
    --fb-bg:        #f7f4ee;
    --fb-surface:   #ffffff;
    --fb-ink:       #1a1817;
    --fb-ink-soft:  #5b574f;
    --fb-line:      #e3dcd0;
    --fb-line-soft: #efeae0;
    --fb-accent:    #b8431a;          /* film-safelight / sienna */
    --fb-accent-2:  #d4a574;          /* warm tan */
    --fb-success:   #4a6b3d;
    --fb-shadow:    0 1px 0 rgba(26,24,23,.04), 0 24px 48px -24px rgba(26,24,23,.18);

    --fb-display:   'Fraunces', 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --fb-mono:      'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    --fb-body:      -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    display: block;
    max-width: 880px;
    margin: 2.5rem auto;
    padding: clamp(1.5rem, 4vw, 2.75rem);
    background: var(--fb-bg);
    color: var(--fb-ink);
    border: 1px solid var(--fb-line);
    border-radius: 4px;
    font-family: var(--fb-body);
    font-size: 16px;
    line-height: 1.5;
    box-shadow: var(--fb-shadow);
    position: relative;
}

.fb + .fb {
    margin-top: 1.5rem;
}

/* Diskret kant-detalje øverst */
.fb::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    height: 3px;
    width: 64px;
    background: var(--fb-accent);
}

/* --- Header --------------------------------------------------- */
.fb__head {
    margin-bottom: 1.75rem;
}

.fb__title {
    font-family: var(--fb-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    line-height: 1.1;
    margin: 0 0 0.45rem;
    color: var(--fb-ink);
    letter-spacing: -0.01em;
}

.fb__lede {
    margin: 0;
    color: var(--fb-ink-soft);
    font-size: 0.95rem;
    max-width: 56ch;
}

/* --- Form-grid ------------------------------------------------ */
.fb__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem 1.25rem;
    margin-bottom: 1.75rem;
}

.fb__field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.fb__label {
    font-family: var(--fb-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fb-ink-soft);
}

.fb__inputwrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

.fb__input {
    font: inherit;
    font-family: var(--fb-mono);
    font-size: 1rem;
    padding: 0.7rem 0.85rem;
    width: 100%;
    background: var(--fb-surface);
    color: var(--fb-ink);
    border: 1px solid var(--fb-line);
    border-radius: 2px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
    appearance: none;
    -webkit-appearance: none;
}

select.fb__input {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--fb-ink-soft) 50%),
        linear-gradient(135deg, var(--fb-ink-soft) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.25rem;
}

.fb__input:focus {
    outline: none;
    border-color: var(--fb-accent);
    box-shadow: 0 0 0 3px rgba(184,67,26,.12);
}

.fb__inputwrap .fb__input {
    padding-right: 2.5rem;
}

.fb__unit {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--fb-mono);
    font-size: 0.8rem;
    color: var(--fb-ink-soft);
    pointer-events: none;
}

/* --- Resultater ----------------------------------------------- */
.fb__results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0;
    border-top: 1px solid var(--fb-line);
    border-bottom: 1px solid var(--fb-line);
    margin: 0.5rem -1rem 1.5rem;
}

.fb__result {
    padding: 1.1rem 1rem;
    border-right: 1px solid var(--fb-line-soft);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.fb__result:last-child {
    border-right: 0;
}

.fb__rlabel {
    font-family: var(--fb-mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fb-ink-soft);
}

.fb__rval {
    font-family: var(--fb-display);
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1;
    color: var(--fb-ink);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.fb__result--accent .fb__rval {
    color: var(--fb-accent);
    font-style: italic;
}

/* --- "Hero"-resultat (hyperfokal, ND) ------------------------- */
.fb__hero {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--fb-surface);
    border: 1px solid var(--fb-line);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fb__hero-label {
    font-family: var(--fb-mono);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--fb-ink-soft);
}

.fb__hero-value {
    font-family: var(--fb-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(2.6rem, 6vw, 3.6rem);
    line-height: 1;
    color: var(--fb-accent);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.fb__hero-sub {
    color: var(--fb-ink-soft);
    font-size: 0.95rem;
}

.fb__hero-sub em {
    font-style: normal;
    font-family: var(--fb-mono);
    color: var(--fb-ink);
}

/* --- DOF-visualisering ---------------------------------------- */
.fb__viz {
    margin-top: 1.5rem;
}

.fb__viz-track {
    position: relative;
    height: 14px;
    background:
        repeating-linear-gradient(90deg,
            var(--fb-line-soft) 0 1px,
            transparent 1px 40px);
    border-top: 1px solid var(--fb-line);
    border-bottom: 1px solid var(--fb-line);
}

.fb__viz-zone {
    position: absolute;
    top: -1px; bottom: -1px;
    background: var(--fb-accent);
    opacity: 0.85;
    transition: left 200ms ease, width 200ms ease;
}

.fb__viz-focus {
    position: absolute;
    top: -6px;
    width: 2px;
    height: 26px;
    background: var(--fb-ink);
    transition: left 200ms ease;
}

.fb__viz-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-family: var(--fb-mono);
    font-size: 0.78rem;
    color: var(--fb-ink-soft);
}

.fb__viz-labels span:nth-child(2) {
    color: var(--fb-accent);
}

/* --- Footnote ------------------------------------------------- */
.fb__footnote {
    margin: 0;
    font-size: 0.82rem;
    color: var(--fb-ink-soft);
    line-height: 1.5;
    border-top: 1px dashed var(--fb-line);
    padding-top: 0.9rem;
}

/* =============================================================
 * Eksponeringstrekant
 * ============================================================= */

.fb--tri .fb__tri-wrap {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1.4fr);
    gap: 2rem;
    align-items: start;
}

@media (max-width: 720px) {
    .fb--tri .fb__tri-wrap {
        grid-template-columns: 1fr;
    }
}

.fb__tri-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.fb__tri-svg {
    width: 100%;
    max-width: 360px;
    height: auto;
    overflow: visible;
}

.fb__tri-poly {
    stroke: var(--fb-line);
    stroke-width: 1.5;
    transition: filter 200ms ease;
}

.fb__tri-spokes line {
    stroke: var(--fb-line);
    stroke-width: 1;
    stroke-dasharray: 2 4;
}

.fb__tri-corner {
    cursor: grab;
    transition: transform 180ms ease;
    transform-origin: center;
}

.fb__tri-corner:active,
.fb__tri-corner.is-dragging {
    cursor: grabbing;
}

.fb__tri-corner circle {
    fill: var(--fb-surface);
    stroke: var(--fb-ink);
    stroke-width: 1.5;
    transition: fill 180ms ease, stroke 180ms ease, r 180ms ease;
}

.fb__tri-corner:hover circle,
.fb__tri-corner:focus-visible circle {
    fill: var(--fb-accent);
    stroke: var(--fb-accent);
}

.fb__tri-corner:hover .fb__tri-cap,
.fb__tri-corner:hover .fb__tri-val,
.fb__tri-corner:focus-visible .fb__tri-cap,
.fb__tri-corner:focus-visible .fb__tri-val {
    fill: var(--fb-surface);
}

.fb__tri-corner:focus-visible {
    outline: none;
}

.fb__tri-corner:focus-visible circle {
    filter: drop-shadow(0 0 0 3px rgba(184,67,26,.25));
}

.fb__tri-cap {
    font-family: var(--fb-mono);
    font-size: 7px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    fill: var(--fb-ink-soft);
    pointer-events: none;
}

.fb__tri-val {
    font-family: var(--fb-display);
    font-style: italic;
    font-size: 13px;
    fill: var(--fb-ink);
    pointer-events: none;
}

/* Preview-bar */
.fb__tri-preview {
    width: 100%;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    background: var(--fb-surface);
    border: 1px solid var(--fb-line);
    border-radius: 2px;
}

.fb__tri-preview-bar {
    flex: 1;
    height: 14px;
    background: linear-gradient(to right,
        #1a1817 0%,
        #6b665e 50%,
        #f5f1e8 100%);
    position: relative;
    border-radius: 1px;
}

.fb__tri-preview-bar::after {
    content: '';
    position: absolute;
    top: -3px; bottom: -3px;
    width: 3px;
    background: var(--fb-accent);
    left: 50%;
    transform: translateX(-50%);
    transition: left 200ms ease;
}

.fb__tri-preview-label {
    font-family: var(--fb-mono);
    font-size: 0.78rem;
    color: var(--fb-ink);
    min-width: 4.5ch;
    text-align: right;
}

/* Controls (sliders) */
.fb__tri-controls {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.fb__tri-scene {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--fb-line);
    margin-bottom: 0.2rem;
}

.fb__tri-scenehint {
    font-family: var(--fb-mono);
    font-size: 0.78rem;
    color: var(--fb-accent);
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

.fb__tri-row {
    display: grid;
    grid-template-columns: minmax(80px, 110px) 1fr;
    grid-template-rows: auto auto;
    column-gap: 1rem;
    row-gap: 0.25rem;
    align-items: center;
}

.fb__tri-rowlabel {
    font-family: var(--fb-mono);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fb-ink-soft);
}

.fb__tri-rowctrl {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fb__tri-rowhint {
    grid-column: 2 / -1;
    font-size: 0.78rem;
    color: var(--fb-ink-soft);
    font-style: italic;
}

.fb__btn {
    font-family: var(--fb-mono);
    font-size: 1rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--fb-line);
    background: var(--fb-surface);
    color: var(--fb-ink);
    cursor: pointer;
    border-radius: 2px;
    transition: all 120ms ease;
    padding: 0;
    line-height: 1;
}

.fb__btn:hover {
    border-color: var(--fb-accent);
    color: var(--fb-accent);
}

.fb__btn:active {
    transform: translateY(1px);
}

.fb__btn--ghost {
    width: auto;
    padding: 0 0.85rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Custom range slider */
.fb__range {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 2px;
    background: var(--fb-line);
    outline: none;
    border-radius: 0;
}

.fb__range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--fb-surface);
    border: 1.5px solid var(--fb-ink);
    cursor: pointer;
    border-radius: 50%;
    transition: all 120ms ease;
}

.fb__range::-webkit-slider-thumb:hover {
    background: var(--fb-accent);
    border-color: var(--fb-accent);
    transform: scale(1.1);
}

.fb__range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--fb-surface);
    border: 1.5px solid var(--fb-ink);
    cursor: pointer;
    border-radius: 50%;
}

.fb__range::-moz-range-thumb:hover {
    background: var(--fb-accent);
    border-color: var(--fb-accent);
}

/* Switch */
.fb__tri-lock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--fb-line);
    flex-wrap: wrap;
}

.fb__switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
}

.fb__switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fb__switch-slider {
    width: 36px;
    height: 20px;
    background: var(--fb-line);
    border-radius: 999px;
    position: relative;
    transition: background 180ms ease;
    flex-shrink: 0;
}

.fb__switch-slider::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--fb-surface);
    transition: transform 180ms ease;
    box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

.fb__switch input:checked + .fb__switch-slider {
    background: var(--fb-accent);
}

.fb__switch input:checked + .fb__switch-slider::after {
    transform: translateX(16px);
}

.fb__switch-label {
    font-size: 0.85rem;
    color: var(--fb-ink);
}

/* Når man over-/undereksponerer */
.fb--tri.is-over .fb__tri-poly,
.fb--tri.is-under .fb__tri-poly {
    filter: saturate(1.4);
}

.fb--tri.is-over .fb__tri-preview-bar::after {
    background: #d97757;
}

.fb--tri.is-under .fb__tri-preview-bar::after {
    background: #4a6b3d;
}

/* Mobile-justeringer */
@media (max-width: 600px) {
    .fb {
        padding: 1.25rem;
    }
    .fb__results {
        margin-left: 0;
        margin-right: 0;
    }
    .fb__result {
        border-right: 0;
        border-bottom: 1px solid var(--fb-line-soft);
    }
    .fb__result:last-child {
        border-bottom: 0;
    }
    .fb__tri-row {
        grid-template-columns: 1fr;
    }
    .fb__tri-rowhint {
        grid-column: 1;
    }
}


/* Kelvin og hudtoner v4.3 */
.fb.fb--kelvin{
  width:100%;
  max-width:880px;
  margin:2.5rem auto;
  box-sizing:border-box;
}
.fb--kelvin .fb__head{margin-bottom:1.25rem}
.fb--kelvin .fb__title{margin-bottom:0}
.fb--kelvin .fb__skin-picker{margin-bottom:1.35rem}
.fb--kelvin .fb__tones{
  display:grid;
  grid-template-columns:repeat(10,minmax(0,1fr));
  gap:.55rem;
  margin-top:.55rem;
}
.fb--kelvin .fb__tone{
  display:flex;
  flex-direction:column;
  gap:.35rem;
  min-width:0;
  border:0;
  background:transparent;
  color:var(--fb-ink-soft);
  padding:3px;
  cursor:pointer;
  font:inherit;
}
.fb--kelvin .fb__tone:focus-visible{outline:none}
.fb--kelvin .fb__swatch{
  display:block;
  width:100%;
  height:46px;
  border:1px solid rgba(0,0,0,.10);
  border-radius:2px;
}
.fb--kelvin .fb__tone-label{
  font-family:var(--fb-mono);
  font-size:.62rem;
  text-align:center;
  white-space:nowrap;
}
.fb--kelvin .fb__tone[aria-pressed=true] .fb__swatch{outline:2px solid var(--fb-accent);outline-offset:2px}
.fb--kelvin .fb__tone:hover .fb__swatch,.fb--kelvin .fb__tone:focus-visible .fb__swatch{outline:1px solid var(--fb-accent);outline-offset:2px}
.fb--kelvin .fb__compare{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:2px;
  background:var(--fb-line);
  border-radius:2px;
  overflow:hidden;
}
.fb--kelvin .fb__panel{position:relative;min-width:0;background:#b9b0a6;overflow:hidden}
.fb--kelvin .fb__photo{
  position:relative;
  aspect-ratio:3/2;
  overflow:hidden;
  background:#b9b0a6;
}
.fb--kelvin .fb__photo img,
.fb--kelvin .fb__photo canvas{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:center;
  background:#b9b0a6;
}
.fb--kelvin .fb__stamp{
  position:absolute;
  top:.85rem;
  left:.85rem;
  z-index:1;
  background:rgba(18,18,18,.76);
  color:#fff;
  border-radius:2px;
  padding:.42rem .65rem;
  font-family:var(--fb-mono);
  font-size:.67rem;
  line-height:1.4;
  pointer-events:none;
}
.fb--kelvin .fb__stamp strong{display:block;font-size:1.1em;font-weight:500}
.fb--kelvin .fb__kelvin-controls{margin-top:1.3rem}
.fb--kelvin .fb__kelvin-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:1rem;
  margin-bottom:.55rem;
}
.fb--kelvin .fb__kelvin-head .fb__label{margin:0}
.fb--kelvin .fb__kelvin-now{
  font-family:var(--fb-mono);
  font-size:.8rem;
  color:var(--fb-ink-soft);
  white-space:nowrap;
}
.fb--kelvin .fb__spectrum{
  position:relative;
  height:19px;
  border-radius:999px;
  border:1px solid var(--fb-line);
  background:linear-gradient(90deg,#d37a39 0%,#e8c08e 22%,#eee7dd 43%,#f5f5f3 60%,#dceaf4 79%,#bfd8ef 90%,#a8cde9 100%);
}
.fb--kelvin .fb__spectrum input[type=range]{
  -webkit-appearance:none;
  appearance:none;
  position:absolute;
  inset:-10px 0;
  width:100%;
  height:39px;
  margin:0;
  padding:0;
  background:transparent;
  border:0;
  cursor:pointer;
}
.fb--kelvin .fb__spectrum input::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:22px;
  height:22px;
  border:2px solid #fff;
  border-radius:50%;
  background:#f4f4f4;
  box-shadow:0 0 0 1px rgba(0,0,0,.2),0 2px 8px rgba(0,0,0,.15);
}
.fb--kelvin .fb__spectrum input::-moz-range-thumb{
  width:20px;
  height:20px;
  border:2px solid #fff;
  border-radius:50%;
  background:#f4f4f4;
  box-shadow:0 0 0 1px rgba(0,0,0,.2),0 2px 8px rgba(0,0,0,.15);
}
.fb--kelvin .fb__ticks{
  display:flex;
  justify-content:space-between;
  gap:.5rem;
  margin-top:.58rem;
  color:var(--fb-ink-soft);
  font-family:var(--fb-mono);
  font-size:.62rem;
}
.fb--kelvin .fb__footnote{
  margin-top:1rem;
  padding-top:.9rem;
  border-top:1px dashed var(--fb-line);
  text-align:center;
  color:var(--fb-ink-soft);
  font-size:.75rem;
}
@media (max-width:760px){
  .fb--kelvin .fb__tones{grid-template-columns:repeat(5,minmax(0,1fr))}
  .fb--kelvin .fb__swatch{height:38px}
}
@media (max-width:560px){
  .fb--kelvin .fb__compare{grid-template-columns:1fr}
  .fb--kelvin .fb__stamp{top:.7rem;left:.7rem}
  .fb--kelvin .fb__ticks{font-size:.54rem}
  .fb--kelvin .fb__kelvin-now{font-size:.72rem}
}

/* v4.5: Kelvin slider fra 2500 til 7500 */
.fb--kelvin .fb__spectrum {background:linear-gradient(90deg,#e98032 0%,#f4c28b 20%,#f3e7cf 39%,#f7f6f2 59%,#d3e7f6 78%,#93c5f2 100%);}
