:root {
    --bg: #0e1928;
    --panel: #1a2541;
    --text: #f0f6ff;
    --muted: #b8c8e0;
    --accent: #FDB813; /* sun */
    --accent-2: #6ee7db; /* aurora teal */
    --accent-pink: #ff9dd4; /* aurora pink */
    --accent-green: #8dffa6; /* aurora green */
    --healthcare-blue: #87ceeb; /* healthcare light blue */
    --chip: #2d3a58;
    --link: #a8c5ff;
    --pulse: rgba(135, 206, 235, 0.25); /* healthcare blue pulse */
}
/* Prevent i18n flash: hide translatable nodes until language applied */
html.i18n-wait [data-i18n],
html.i18n-wait [data-i18n-label],
html.i18n-wait .lang-toggle { visibility: hidden; }

/* Enhanced accessibility and focus states */
*:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 4px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: #1a4a5c;
    color: var(--text);
    text-align: center;
    min-height: 100vh;
}

/* Center container for home page */
body:has(.container.home) {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Scroll layout for info pages */
body:has(.container.info-page) {
    padding: 20px 0;
}

/* Aurora background used on Development and analysis pages */
.aurora-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.6;
}
.aurora-bg span {
    position: absolute;
    width: 42vw;
    height: 42vh;
    filter: blur(28px);
    opacity: 0.7;
    mix-blend-mode: screen;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: auroraFloat 18s ease-in-out infinite;
}
.aurora-bg span:nth-child(1) {
    left: 15%; top: 25%;
    background: radial-gradient(45% 60% at 50% 50%, var(--accent-2), transparent 70%);
}
.aurora-bg span:nth-child(2) {
    left: 35%; top: 65%;
    background: radial-gradient(45% 60% at 50% 50%, var(--healthcare-blue), transparent 70%);
    animation-duration: 22s;
}
.aurora-bg span:nth-child(3) {
    left: 60%; top: 30%;
    background: radial-gradient(45% 60% at 50% 50%, var(--accent-pink), transparent 70%);
    animation-duration: 26s;
}
.aurora-bg span:nth-child(4) {
    left: 80%; top: 70%;
    background: radial-gradient(45% 60% at 50% 50%, var(--accent-green), transparent 70%);
    animation-duration: 24s;
}
.aurora-bg span:nth-child(5) {
    left: 50%; top: 15%;
    background: radial-gradient(45% 60% at 50% 50%, rgba(168, 197, 255, 0.9), transparent 70%);
    animation-duration: 28s;
}
.aurora-bg span:nth-child(6) {
    left: 25%; top: 85%;
    background: radial-gradient(45% 60% at 50% 50%, rgba(110, 231, 219, 0.9), transparent 70%);
    animation-duration: 30s;
}
.aurora-bg span:nth-child(7) {
    left: 75%; top: 50%;
    background: radial-gradient(45% 60% at 50% 50%, rgba(135, 206, 235, 0.9), transparent 70%);
    animation-duration: 32s;
}

@keyframes auroraFloat {
    0%, 100% { transform: translate(-50%, -50%) translate3d(0, 0, 0); }
    25% { transform: translate(-50%, -50%) translate3d(10px, -12px, 0); }
    50% { transform: translate(-50%, -50%) translate3d(-8px, 10px, 0); }
    75% { transform: translate(-50%, -50%) translate3d(6px, 8px, 0); }
}

.container {
    padding: 27px 20px 20px;
    background-color: var(--panel);
    border-radius: 16px;
    max-width: 800px;
    margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0, 10, 30, 0.35);
    max-width: 782px;
    width: min(95vw, 816px);
}

.info-page,
.daylight-page {
    background: linear-gradient(135deg, var(--panel), #1e2d46);
    border: 1px solid var(--healthcare-blue);
}

/* Tromsø Northern Lights */
.northern-lights {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: -1;
    opacity: 0.65;
}

.light-curtain {
    position: absolute;
    width: 25vw;
    height: 100vh;
    background: linear-gradient(
        to top,
        rgba(64, 224, 136, 0.8) 0%,
        rgba(64, 224, 136, 0.6) 15%,
        rgba(110, 231, 219, 0.4) 35%,
        rgba(135, 206, 235, 0.3) 60%,
        rgba(168, 197, 255, 0.15) 80%,
        transparent 100%
    );
    filter: blur(2px);
    transform-origin: bottom center;
}

.curtain-1 {
    left: 15%;
    animation: aurora-dance-1 13.2s ease-in-out infinite;
    background: linear-gradient(
        to top,
        rgba(64, 224, 136, 0.9) 0%,
        rgba(110, 231, 219, 0.6) 25%,
        rgba(135, 206, 235, 0.4) 50%,
        rgba(168, 197, 255, 0.2) 75%,
        transparent 100%
    );
}

.curtain-2 {
    left: 35%;
    animation: aurora-dance-2 16.5s ease-in-out infinite;
    animation-delay: 0s;
    background: linear-gradient(
        to top,
        rgba(110, 231, 219, 0.8) 0%,
        rgba(135, 206, 235, 0.6) 30%,
        rgba(168, 197, 255, 0.4) 60%,
        rgba(200, 220, 255, 0.15) 85%,
        transparent 100%
    );
}

.curtain-3 {
    left: 55%;
    animation: aurora-dance-3 19.8s ease-in-out infinite;
    animation-delay: 0s;
    background: linear-gradient(
        to top,
        rgba(64, 224, 136, 0.7) 0%,
        rgba(64, 224, 136, 0.5) 20%,
        rgba(110, 231, 219, 0.4) 40%,
        rgba(135, 206, 235, 0.25) 70%,
        transparent 100%
    );
}

.curtain-4 {
    left: 75%;
    animation: aurora-dance-4 22s ease-in-out infinite;
    animation-delay: 0s;
    background: linear-gradient(
        to top,
        rgba(135, 206, 235, 0.6) 0%,
        rgba(168, 197, 255, 0.5) 35%,
        rgba(200, 220, 255, 0.3) 65%,
        transparent 100%
    );
}

@keyframes aurora-dance-1 {
    0%, 100% {
        transform: skewX(2deg) scaleY(0.8);
        opacity: 0.6;
    }
    25% {
        transform: skewX(-3deg) scaleY(1.1);
        opacity: 0.9;
    }
    50% {
        transform: skewX(4deg) scaleY(0.9);
        opacity: 0.7;
    }
    75% {
        transform: skewX(-2deg) scaleY(1.05);
        opacity: 0.8;
    }
}

@keyframes aurora-dance-2 {
    0%, 100% {
        transform: skewX(-1deg) scaleY(0.9);
        opacity: 0.5;
    }
    30% {
        transform: skewX(3deg) scaleY(1.2);
        opacity: 0.8;
    }
    60% {
        transform: skewX(-4deg) scaleY(0.7);
        opacity: 0.6;
    }
}

@keyframes aurora-dance-3 {
    0%, 100% {
        transform: skewX(3deg) scaleY(1.0);
        opacity: 0.7;
    }
    20% {
        transform: skewX(-2deg) scaleY(0.8);
        opacity: 0.5;
    }
    40% {
        transform: skewX(5deg) scaleY(1.3);
        opacity: 0.9;
    }
    80% {
        transform: skewX(-1deg) scaleY(0.9);
        opacity: 0.6;
    }
}

@keyframes aurora-dance-4 {
    0%, 100% {
        transform: skewX(-2deg) scaleY(0.85);
        opacity: 0.4;
    }
    35% {
        transform: skewX(2deg) scaleY(1.1);
        opacity: 0.7;
    }
    70% {
        transform: skewX(-3deg) scaleY(1.0);
        opacity: 0.6;
    }
}


/* Home page */
.home { text-align: center; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.spacer { flex: 1; }
.lang-toggle { display: inline-flex; gap: 6px; background: #1a2340; border: 1px solid #3d5078; border-radius: 999px; padding: 4px; }
.lang-toggle .lang { appearance: none; background: transparent; border: 0; color: var(--muted); padding: 6px 10px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 0.85rem; transition: all 0.2s ease; }
.lang-toggle .lang[aria-pressed="true"] { background: #2a3858; color: var(--text); box-shadow: inset 0 0 0 1px var(--healthcare-blue); }
.lang-toggle .lang:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 12px;
  background: rgba(77, 209, 197, 0.1);
}
.hero { margin: 8px 0 20px; }
.owl-link { display: inline-block; text-decoration: none; cursor: pointer; transition: transform 0.2s ease, filter 0.2s ease; }
.owl-link:hover { transform: scale(1.08); filter: brightness(1.15); }
.owl-link:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; border-radius: 50%; }
.owl { font-size: 4rem; line-height: 1; filter: drop-shadow(0 4px 14px rgba(0,0,0,0.45)) drop-shadow(0 0 24px rgba(255, 220, 120, 0.15)); animation: owlPulse 4s ease-in-out infinite; }
@keyframes owlPulse { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.brand { margin: 8px 0 4px; font-size: clamp(1.8rem, 4vw, 2.4rem); letter-spacing: 0.4px; }
.tag { color: var(--muted); margin: 0; }
.btn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 18px; }
.btn {
  position: relative; overflow: hidden;
  display: inline-block; text-decoration: none; color: var(--text);
  background: linear-gradient(180deg, #2a3858, #1e2d46);
  border: 1px solid #3d5078; border-radius: 14px; padding: 16px 18px;
  transition: transform .16s ease, background .25s ease, border-color .25s ease, box-shadow .16s ease;
}
.btn::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(135, 206, 235, 0.06) 50%, transparent 70%);
  animation: btnShimmer 4s ease-in-out infinite;
  pointer-events: none;
}
.btn::after { content: ""; position: absolute; inset: -20%; transform: translateX(-120%) rotate(12deg);
  background: linear-gradient(90deg, transparent, rgba(240, 246, 255, 0.15), transparent);
  transition: transform .45s ease;
}
@keyframes btnShimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}
.btn.cta { box-shadow: 0 6px 18px rgba(0,0,0,.25), 0 0 0 0 var(--pulse); }
.btn.cta:hover { transform: translateY(-2px) scale(1.06); background: linear-gradient(180deg, #3a4a70, #2a3858); border-color: var(--healthcare-blue); box-shadow: 0 12px 28px rgba(0,0,0,.35), 0 0 0 8px var(--pulse); }
.btn:hover::after { transform: translateX(140%) rotate(12deg); }
.btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 16px;
  box-shadow: 0 0 0 4px rgba(77, 209, 197, 0.2);
}

.info-page .header {
    text-align: center;
    margin-bottom: 27px;
}

.info-page .header h1 {
    font-size: clamp(1.7rem, 3.06vw, 2.38rem);
    letter-spacing: 0.5px;
    text-shadow: 0 8px 22px rgba(10, 20, 40, 0.45);
}

.info-page .header .sub,
.daylight-page .header .sub {
    font-size: clamp(0.85rem, 1.7vw, 0.98rem);
    color: rgba(210, 226, 255, 0.82);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.daylight-page .header h1 {
    margin-bottom: 4px;
}

.daylight-page .header .sub {
    margin-bottom: 8px;
}

.info-page .content {
    display: grid;
    gap: 17px;
}

.info-page .lead {
    font-size: clamp(0.94rem, 2.13vw, 1.06rem);
    line-height: 1.75;
    color: var(--text);
    margin: 0;
    padding: 15px 19px;
    display: grid;
    grid-template-columns: 44px 1fr;
    align-items: center;
    gap: 14px;
    border-radius: 12px;
    background: rgba(21, 34, 56, 0.68);
    border: 1px solid rgba(135, 206, 235, 0.32);
    box-shadow: 0 10px 27px rgba(6, 14, 30, 0.35);
}

.info-page .lead:first-child {
    border-left: 4px solid var(--accent-2);
}

.info-page .lead-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 41px;
    height: 41px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.info-page .lead-icon svg {
    width: 22px;
    height: 22px;
    display: block;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.info-page .lead-icon--sleep svg {
    width: 27px;
    height: 27px;
}

.info-page .lead-copy {
    display: block;
}

/* Mobile optimizations for info page */
@media (max-width: 480px) {
    .info-page .header h1 {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
    }

    .info-page .lead {
        padding: 12px 16px;
        grid-template-columns: 36px 1fr;
        gap: 12px;
        font-size: clamp(0.85rem, 2.8vw, 0.95rem);
    }

    .info-page .lead-icon {
        width: 36px;
        height: 36px;
    }

    .info-page .lead-icon svg {
        width: 18px;
        height: 18px;
    }

    .info-page .lead-icon--sleep svg {
        width: 22px;
        height: 22px;
    }

    .container {
        padding: 20px 16px 16px;
        width: min(98vw, 100%);
    }
}

.dev-page .todo { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.dev-page .todo li { text-align: left; background: #1e2d46; border: 1px solid #3d5078; padding: 12px 14px; border-radius: 12px; color: var(--text); transition: border-color 0.2s ease; }
.dev-page .todo li:hover { border-color: var(--healthcare-blue); }
.dev-page .todo .tag { color: var(--healthcare-blue); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin-right: 8px; font-weight: 600; }

.header h1 {
    margin: 0 0 6px;
    font-size: clamp(1.6rem, 2.5vw, 2.2rem);
    letter-spacing: 0.3px;
}

.header .sub {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 0.95rem;
}

.viz { margin: 2px 0 0; }

svg#sunViz {
    width: 100%;
    height: auto;
    display: block;
}

.horizon {
    stroke: #2a3553;
    stroke-width: 2;
    stroke-linecap: round;
}

.path {
    fill: none;
    stroke: var(--accent-2);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 6 8;
    opacity: 0.9;
}

.sun {
    fill: var(--accent);
    stroke: rgba(255, 255, 255, 0.6);
    stroke-width: 1;
    filter: drop-shadow(0 0 8px rgba(253, 184, 19, 0.6));
}

/* Faded markers when hovering sunrise/sunset */
.sun.ghost {
    fill: var(--accent-2);
    opacity: 0.45; /* slightly less transparent for better visibility */
    filter: none;
    display: none;
    pointer-events: none;
}
.sun.ghost.show { display: block; }

.info { margin-top: 4px; }

.greeting {
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    color: var(--text);
    margin: 8px 0 14px;
}

/* Live clock in daylight arc */
svg#sunViz .clock {
    fill: var(--text);
    opacity: 0.9;
    font-size: 28px;
    font-weight: 700;
    paint-order: stroke;
    stroke: rgba(0,0,0,0.35);
    stroke-width: 2px;
}

/* Direction labels */
svg#sunViz .direction-label {
    fill: #ffffff;
    opacity: 0.7;
    font-size: 18px;
    font-weight: 400;
}

/* Gentle slow pulse for the live sun */
#sun {
    transform-origin: center;
    transform-box: fill-box;
    animation: sunPulse 6s ease-in-out infinite; /* slightly faster */
}
@keyframes sunPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(253, 184, 19, 0.6)); }
    50% { transform: scale(1.12); filter: drop-shadow(0 0 16px rgba(253, 184, 19, 0.95)); }
}

.times { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip {
    background: var(--chip);
    border: 1px solid #27304a;
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chip:focus-visible {
    outline: 2px solid var(--accent-2);
    outline-offset: 2px;
    border-color: var(--accent-2);
}

.link { color: var(--link); text-decoration: none; }
.link:hover { text-decoration: underline; }

/* Enhanced responsive design */
@media (max-width: 768px) {
    .container { padding: 24px 16px; }
    .btn-grid { grid-template-columns: 1fr; gap: 16px; }
    .lang-toggle { scale: 0.9; }
    .owl { font-size: 3.5rem; }
    .times { gap: 6px; }
    .chip { padding: 8px 12px; font-size: 0.85rem; }
}

@media (max-width: 520px) {
    .container { padding: 20px 14px; }
    .hero { margin: 6px 0 16px; }
    .brand { font-size: clamp(1.6rem, 6vw, 2rem); }
    .btn { padding: 14px 16px; }
    .times { gap: 4px; }
}

/* Enhanced Arctic winter theme for very dark environments */
@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
    :root {
        --bg: #0a1218;
        --panel: #151f2e;
        --text: #f8fbff;
        --muted: #c2d1e8;
        --healthcare-blue: #9dd4eb;
    }
}

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

/* Daylight page slightly smaller */
.daylight-page {
    max-width: 782px;
    width: min(85vw, 820px);
    padding: 12px 18px 12px;
}
