/*
      Spletna kamera Triglav
      Statična rešitev: HTML + CSS + JavaScript
      Brez PHP, brez backend kode, brez frameworkov.
    */

    :root {
      color-scheme: light;
      --bg: #f5f8f6;
      --surface: rgba(255, 255, 255, 0.82);
      --surface-strong: #ffffff;
      --surface-muted: #eef3ef;
      --text: #171717;
      --muted: #5f6863;
      --soft: #89928d;
      --accent: #0f766e;
      --accent-strong: #0b5f59;
      --accent-soft: rgba(15, 118, 110, 0.12);
      --berry: #b42363;
      --snow: #dfeceb;
      --border: rgba(23, 23, 23, 0.12);
      --border-strong: rgba(23, 23, 23, 0.18);
      --success-bg: rgba(15, 118, 110, 0.12);
      --success-text: #0f766e;
      --warning-bg: rgba(217, 119, 6, 0.13);
      --warning-text: #92400e;
      --error-bg: rgba(220, 38, 38, 0.12);
      --error-text: #b91c1c;
      --shadow-lg: 0 32px 80px rgba(26, 24, 20, 0.16);
      --shadow-md: 0 18px 45px rgba(26, 24, 20, 0.10);
      --radius-xl: 28px;
      --radius-lg: 20px;
      --radius-md: 14px;
      --radius-sm: 10px;
    }

    @media (prefers-color-scheme: dark) {
      :root {
        color-scheme: dark;
        --bg: #101211;
        --surface: rgba(26, 30, 29, 0.84);
        --surface-strong: #171a19;
        --surface-muted: #202624;
        --text: #f4f1ec;
        --muted: #b5bdb8;
        --soft: #8c9892;
        --accent: #4fd1c5;
        --accent-strong: #7ddbd3;
        --accent-soft: rgba(79, 209, 197, 0.13);
        --berry: #fb7185;
        --snow: #1f2c2b;
        --border: rgba(244, 241, 236, 0.14);
        --border-strong: rgba(244, 241, 236, 0.22);
        --success-bg: rgba(79, 209, 197, 0.12);
        --success-text: #7ddbd3;
        --warning-bg: rgba(245, 158, 11, 0.14);
        --warning-text: #fbbf24;
        --error-bg: rgba(248, 113, 113, 0.14);
        --error-text: #fca5a5;
        --shadow-lg: 0 34px 90px rgba(0, 0, 0, 0.42);
        --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.30);
      }
    }

    * {
      box-sizing: border-box;
    }

    html {
      min-width: 320px;
      background: var(--bg);
    }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      color: var(--text);
      background:
        linear-gradient(155deg, rgba(15, 118, 110, 0.10), transparent 28rem),
        linear-gradient(25deg, transparent 0 58%, color-mix(in srgb, var(--berry) 10%, transparent) 58% 100%),
        var(--bg);
      text-rendering: optimizeLegibility;
      -webkit-font-smoothing: antialiased;
    }

    a {
      color: inherit;
      text-decoration-color: rgba(15, 118, 110, 0.42);
      text-decoration-thickness: 2px;
      text-underline-offset: 0.22em;
      font-weight: 760;
    }

    a:hover,
    a:focus-visible {
      color: var(--accent-strong);
      text-decoration-color: currentColor;
    }

    button {
      font: inherit;
    }

    button:focus-visible,
    a:focus-visible {
      outline: 3px solid color-mix(in srgb, var(--accent) 36%, transparent);
      outline-offset: 3px;
    }

    .page {
      width: min(1240px, 100%);
      margin: 0 auto;
      padding: clamp(18px, 3vw, 38px);
    }

    .header {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 18px;
      align-items: end;
      padding: 4px 2px 24px;
    }

    .eyebrow {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      width: fit-content;
      margin: 0 0 12px;
      color: var(--accent-strong);
      font-size: 0.78rem;
      font-weight: 850;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }

    .eyebrow::before {
      content: "";
      width: 34px;
      height: 2px;
      border-radius: 999px;
      background: currentColor;
    }

    .header h1 {
      max-width: 12ch;
      margin: 0;
      font-size: clamp(2.5rem, 7.4vw, 6.85rem);
      line-height: 0.9;
      letter-spacing: 0;
      text-wrap: balance;
    }

    .header p {
      max-width: 35rem;
      margin: 16px 0 0;
      color: var(--muted);
      font-size: clamp(1rem, 1.8vw, 1.22rem);
      line-height: 1.55;
    }

    .contact-chip {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 44px;
      padding: 10px 14px;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: var(--surface);
      box-shadow: var(--shadow-md);
      backdrop-filter: blur(18px);
      white-space: nowrap;
    }

    .camera-shell {
      overflow: clip;
      border: 1px solid var(--border-strong);
      border-radius: var(--radius-xl);
      background: var(--surface);
      box-shadow: var(--shadow-lg);
      backdrop-filter: blur(18px);
    }

    .camera-stage {
      position: relative;
      display: grid;
      min-height: clamp(320px, 62vw, 760px);
      overflow: hidden;
      background:
        linear-gradient(145deg, rgba(15, 118, 110, 0.18), transparent 42%),
        linear-gradient(315deg, color-mix(in srgb, var(--berry) 13%, transparent), transparent 36%),
        var(--snow);
      isolation: isolate;
    }

    .image-wrap {
      position: relative;
      display: grid;
      place-items: center;
      min-width: 0;
      min-height: 100%;
      padding: clamp(10px, 1.8vw, 18px);
    }

    .image-wrap.has-image-error::before {
      content: "";
      position: absolute;
      inset: clamp(18px, 4vw, 44px);
      border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
      border-radius: clamp(18px, 2.4vw, 28px);
      background:
        linear-gradient(145deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 46%),
        linear-gradient(315deg, color-mix(in srgb, var(--berry) 16%, transparent), transparent 42%),
        color-mix(in srgb, var(--surface-muted) 88%, transparent);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    }

    .image-wrap.has-image-error::after {
      content: "Slika trenutno ni na voljo";
      position: absolute;
      left: 50%;
      top: 50%;
      z-index: 1;
      width: min(360px, calc(100% - 56px));
      transform: translate(-50%, -50%);
      border: 1px solid var(--border);
      border-radius: 999px;
      color: var(--muted);
      background: var(--surface);
      box-shadow: var(--shadow-md);
      padding: 13px 16px;
      text-align: center;
      font-weight: 850;
      backdrop-filter: blur(18px);
    }

    .camera-image {
      display: block;
      width: 100%;
      height: 100%;
      max-height: 760px;
      object-fit: contain;
      border-radius: clamp(18px, 2vw, 24px);
      background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    }

    .image-wrap.has-image-error .camera-image {
      opacity: 0;
    }

    .stage-top,
    .stage-bottom {
      position: absolute;
      left: clamp(14px, 2.3vw, 26px);
      right: clamp(14px, 2.3vw, 26px);
      z-index: 2;
      display: flex;
      gap: 12px;
      align-items: center;
      justify-content: space-between;
      pointer-events: none;
    }

    .stage-top {
      top: clamp(14px, 2.3vw, 26px);
    }

    .stage-bottom {
      bottom: clamp(14px, 2.3vw, 26px);
      align-items: flex-end;
    }

    .status-group,
    .caption-panel,
    .refresh-pill {
      pointer-events: auto;
    }

    .status-group {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }

    .mode-badge,
    .refresh-pill {
      display: inline-flex;
      align-items: center;
      min-height: 42px;
      border: 1px solid rgba(255, 255, 255, 0.32);
      border-radius: 999px;
      color: #ffffff;
      background: rgba(12, 16, 18, 0.58);
      box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
      backdrop-filter: blur(18px);
    }

    .mode-badge {
      gap: 9px;
      padding: 9px 14px;
      font-size: 0.92rem;
      font-weight: 850;
    }

    .mode-badge::before {
      content: "";
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: #5eead4;
      box-shadow: 0 0 0 6px rgba(94, 234, 212, 0.18);
    }

    .mode-badge.is-archive::before {
      background: #fbbf24;
      box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.18);
    }

    .refresh-pill {
      padding: 9px 13px;
      color: rgba(255, 255, 255, 0.88);
      font-size: 0.9rem;
      font-weight: 700;
    }

    .caption-panel {
      width: min(520px, 100%);
      padding: clamp(14px, 2vw, 20px);
      border: 1px solid rgba(255, 255, 255, 0.24);
      border-radius: var(--radius-lg);
      color: #ffffff;
      background: linear-gradient(135deg, rgba(10, 13, 14, 0.68), rgba(10, 13, 14, 0.42));
      box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
      backdrop-filter: blur(18px);
    }

    .caption-panel h2 {
      margin: 0;
      font-size: clamp(1.18rem, 2.6vw, 2rem);
      line-height: 1.06;
      letter-spacing: 0;
      text-wrap: balance;
    }

    .caption-panel p {
      margin: 9px 0 0;
      color: rgba(255, 255, 255, 0.78);
      font-size: 0.98rem;
      line-height: 1.45;
    }

    .live-button {
      pointer-events: auto;
      width: auto;
      min-height: 46px;
      padding: 11px 16px;
      border: 1px solid rgba(255, 255, 255, 0.26);
      border-radius: 999px;
      color: #ffffff;
      background: rgba(15, 118, 110, 0.88);
      box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
      font-weight: 850;
      cursor: pointer;
      transition: transform 170ms ease, background 170ms ease, opacity 170ms ease;
      backdrop-filter: blur(18px);
      white-space: nowrap;
    }

    .live-button:hover {
      transform: translateY(-1px);
      background: rgba(11, 95, 89, 0.94);
    }

    .live-button:disabled {
      cursor: default;
      opacity: 0.52;
      transform: none;
      background: rgba(12, 16, 18, 0.54);
    }

    .message {
      display: none;
      margin: 18px clamp(16px, 2.2vw, 26px) 0;
      padding: 13px 15px;
      border-radius: var(--radius-md);
      line-height: 1.45;
      font-weight: 720;
    }

    .message.is-visible {
      display: block;
    }

    .message.warning {
      color: var(--warning-text);
      background: var(--warning-bg);
      border: 1px solid color-mix(in srgb, var(--warning-text) 20%, transparent);
    }

    .message.error {
      color: var(--error-text);
      background: var(--error-bg);
      border: 1px solid color-mix(in srgb, var(--error-text) 18%, transparent);
    }

    .archive-panel {
      padding: clamp(18px, 3vw, 34px);
      background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.025));
    }

    .archive-heading {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 14px;
      align-items: end;
      margin-bottom: 18px;
    }

    .archive-heading h2 {
      margin: 0;
      font-size: clamp(1.35rem, 2.3vw, 2rem);
      line-height: 1.1;
      letter-spacing: 0;
    }

    .archive-heading p {
      margin: 8px 0 0;
      color: var(--muted);
      line-height: 1.5;
    }

    .archive-count {
      display: inline-flex;
      align-items: center;
      min-height: 36px;
      padding: 8px 11px;
      border: 1px solid var(--border);
      border-radius: 999px;
      color: var(--accent-strong);
      background: var(--accent-soft);
      font-size: 0.86rem;
      font-weight: 850;
      white-space: nowrap;
    }

    .archive-workspace {
      display: grid;
      grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
      gap: 16px;
      align-items: stretch;
    }

    .calendar-card,
    .time-panel {
      min-width: 0;
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      background: var(--surface-strong);
      box-shadow: 0 14px 36px rgba(26, 24, 20, 0.07);
    }

    .calendar-card {
      padding: clamp(14px, 2vw, 20px);
    }

    .archive-nav {
      display: grid;
      grid-template-columns: 46px minmax(0, 1fr) 46px;
      gap: 12px;
      align-items: center;
      margin-bottom: 16px;
    }

    .archive-kicker {
      margin: 0 0 4px;
      color: var(--muted);
      font-size: 0.76rem;
      font-weight: 850;
      letter-spacing: 0.1em;
      text-transform: uppercase;
    }

    .calendar-title,
    .selected-date-title {
      margin: 0;
      font-size: clamp(1.24rem, 2vw, 1.7rem);
      line-height: 1.08;
      letter-spacing: 0;
      text-wrap: balance;
    }

    .icon-button {
      display: inline-grid;
      place-items: center;
      width: 46px;
      height: 46px;
      border: 1px solid var(--border);
      border-radius: 999px;
      color: var(--text);
      background: var(--surface-muted);
      cursor: pointer;
      font-size: 1.4rem;
      font-weight: 900;
      line-height: 1;
      transition: transform 170ms ease, border-color 170ms ease, background 170ms ease, opacity 170ms ease;
    }

    .icon-button:hover:not(:disabled) {
      transform: translateY(-1px);
      border-color: var(--border-strong);
      background: var(--accent-soft);
    }

    .icon-button:disabled {
      cursor: default;
      opacity: 0.38;
    }

    .weekday-row,
    .calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, minmax(0, 1fr));
      gap: 7px;
    }

    .weekday-row span {
      color: var(--soft);
      font-size: 0.72rem;
      font-weight: 850;
      letter-spacing: 0.08em;
      text-align: center;
      text-transform: uppercase;
    }

    .calendar-grid {
      margin-top: 9px;
    }

    .calendar-blank {
      min-height: 58px;
    }

    .calendar-day {
      position: relative;
      display: flex;
      min-width: 0;
      min-height: 58px;
      flex-direction: column;
      justify-content: space-between;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      color: var(--text);
      background: color-mix(in srgb, var(--surface-muted) 62%, transparent);
      padding: 8px;
      text-align: left;
      cursor: pointer;
      transition: transform 170ms ease, border-color 170ms ease, background 170ms ease, color 170ms ease;
    }

    .calendar-day:hover:not(:disabled) {
      transform: translateY(-1px);
      border-color: var(--accent);
      background: var(--accent-soft);
    }

    .calendar-day:disabled {
      cursor: default;
      color: var(--soft);
      background: transparent;
      opacity: 0.48;
    }

    .calendar-day.is-today {
      border-color: color-mix(in srgb, var(--berry) 42%, var(--border));
    }

    .calendar-day.is-selected {
      border-color: var(--accent);
      color: #ffffff;
      background: linear-gradient(135deg, var(--accent), var(--accent-strong));
      box-shadow: 0 12px 24px color-mix(in srgb, var(--accent) 26%, transparent);
    }

    .calendar-day .day-number {
      font-size: 0.96rem;
      font-weight: 850;
    }

    .calendar-day .day-count {
      align-self: flex-end;
      color: currentColor;
      font-size: 0.72rem;
      font-weight: 850;
      opacity: 0.78;
    }

    .archive-state {
      grid-column: 1 / -1;
      display: grid;
      min-height: 226px;
      place-items: center;
      border: 1px dashed var(--border);
      border-radius: var(--radius-lg);
      color: var(--muted);
      background: color-mix(in srgb, var(--surface-muted) 68%, transparent);
      padding: 20px;
      text-align: center;
      font-weight: 760;
    }

    .time-panel {
      display: flex;
      flex-direction: column;
      gap: 16px;
      padding: clamp(14px, 2vw, 20px);
    }

    .selected-date-meta {
      margin: 9px 0 0;
      color: var(--muted);
      line-height: 1.45;
    }

    .hour-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
      gap: 9px;
    }

    .hour-button {
      display: flex;
      min-height: 52px;
      min-width: 0;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      color: var(--text);
      background: var(--surface-muted);
      cursor: pointer;
      font-weight: 850;
      transition: transform 170ms ease, border-color 170ms ease, background 170ms ease;
    }

    .hour-button:hover {
      transform: translateY(-1px);
      border-color: var(--accent);
      background: var(--accent-soft);
    }

    .hour-button.is-active {
      border-color: var(--accent);
      color: #ffffff;
      background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    }

    .hour-button small {
      margin-top: 2px;
      color: currentColor;
      font-size: 0.72rem;
      font-weight: 760;
      opacity: 0.76;
    }

    .archive-status {
      margin: auto 0 0;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      color: var(--muted);
      background: color-mix(in srgb, var(--surface-muted) 72%, transparent);
      padding: 12px 13px;
      line-height: 1.42;
      font-weight: 720;
    }

    .footer {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      margin-top: 18px;
      padding: 0 2px;
      color: var(--muted);
      font-size: 0.94rem;
    }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    @media (max-width: 860px) {
      .header,
      .archive-heading,
      .footer {
        grid-template-columns: 1fr;
      }

      .header {
        align-items: start;
      }

      .contact-chip {
        justify-self: start;
      }

      .stage-top,
      .stage-bottom {
        position: static;
        padding: 14px;
        background: var(--surface-strong);
      }

      .stage-top {
        order: -1;
      }

      .stage-bottom {
        align-items: stretch;
      }

      .camera-stage {
        display: flex;
        min-height: 0;
        flex-direction: column;
      }

    .image-wrap {
        min-height: 260px;
        padding: 10px;
      }

      .camera-image {
        height: auto;
        max-height: 68vh;
      }

      .mode-badge,
      .refresh-pill,
      .caption-panel,
      .live-button {
        border-color: var(--border);
        color: var(--text);
        background: var(--surface-muted);
        box-shadow: none;
      }

      .caption-panel p {
        color: var(--muted);
      }

      .live-button {
        justify-content: center;
        color: #ffffff;
        background: var(--accent);
      }

      .live-button:disabled {
        color: var(--muted);
        background: var(--surface-muted);
      }

      .archive-workspace {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 560px) {
      .page {
        padding: 12px;
      }

      .header {
        padding-bottom: 16px;
      }

      .header h1 {
        font-size: clamp(2.4rem, 15vw, 4.2rem);
      }

      .camera-shell {
        border-radius: 20px;
      }

      .stage-top,
      .stage-bottom {
        gap: 10px;
        flex-direction: column;
        align-items: stretch;
      }

      .status-group {
        display: grid;
        grid-template-columns: 1fr;
      }

      .mode-badge,
      .refresh-pill,
      .live-button {
        width: 100%;
      }

      .archive-panel {
        padding: 16px;
      }

      .archive-nav {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
      }

      .icon-button {
        width: 42px;
        height: 42px;
      }

      .calendar-card,
      .time-panel {
        border-radius: 16px;
      }

      .weekday-row,
      .calendar-grid {
        gap: 5px;
      }

      .calendar-day {
        min-height: 48px;
        border-radius: 12px;
        padding: 6px;
      }

      .calendar-day .day-count {
        font-size: 0.68rem;
      }

      .hour-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }

      .footer {
        flex-direction: column;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
      }
    }
