/* theme.css */

@import url('https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,300;0,400;0,600;0,700;0,800;1,400&family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap');

/* --- CSS Variables --- */
:root {
    --color-primary: #0b303b;       /* Deep Blue/Slate */
    --color-secondary: #5c9030;     /* Vibrant Green */
    --color-tertiary: #f0f0f0;      /* Light Gray Background */
    --color-text: #333333;          /* Dark Gray Text */
    --color-text-light: #666666;    /* Medium Gray Text */
    --color-white: #ffffff;
    --color-border: #e2e8f0;

    --font-heading: 'Raleway', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

/* --- Resets & Base Styles --- */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background: linear-gradient(135deg,rgb(92,144,48) 0%,rgb(208,244,213) 22%,rgb(0,105,56) 97%);
    background-attachment: fixed;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: inherit;
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 160ms ease, background-color 160ms ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Global Components --- */
.pic-card {
    background-color: var(--color-secondary);
    border: 3px solid var(--color-white);
    border-radius: 1.5rem;
    color: var(--color-white);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

.pic-btn {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    border-radius: 9999px;
    font-weight: 700;
    transition: color 160ms ease, transform 120ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.pic-btn:hover {
    color: var(--color-white);
}

.pic-btn:active {
    transform: scale(0.98);
}
/* Shared motion: visible by default, short entrances once on entry. */
:root { --pic-rise: 8px; }
@media (min-width: 900px) { :root { --pic-rise: 12px; } }
@keyframes pic-enter {
    from { opacity: 0; transform: translateY(var(--pic-rise)); }
    to { opacity: 1; transform: none; }
}
.pic-entering { animation: pic-enter 300ms cubic-bezier(.22,1,.36,1) both; }
:where(a, button, [tabindex]):focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 4px;
}
.pic-btn { min-height: 44px; }
#mobile-menu-btn { min-width: 44px; min-height: 44px; border-radius: 8px; }
#mobile-menu a { min-height: 44px; }
#mobile-menu { max-height: calc(100dvh - 110px); overflow-y: auto; }
#mobile-menu[hidden], #mobile-menu-backdrop[hidden] { display: none !important; }
#mobile-menu, #mobile-menu-backdrop { opacity: 0; transition: opacity 200ms ease, transform 200ms ease; }
#mobile-menu { transform: translateX(12px); }
#mobile-menu.is-open, #mobile-menu-backdrop.is-open { opacity: 1; transform: none; }
#main-header { transition: transform 200ms ease; }
#main-header.is-away { transform: translateY(-120%); }
.pic-zoom-source { cursor: zoom-in; transition: opacity 160ms ease; }
@media (hover: hover) and (pointer: fine) {
    .pic-zoom-source:hover { opacity: .9; }
    .pic-hover-card { transition: transform 180ms ease; }
    .pic-hover-card:hover { transform: translateY(-3px); }
}
.pic-btn:active, #mobile-menu-btn:active, .xp-playback button:active { transform: scale(.98); }

/* The native dialog traps focus and makes the page behind it inert. */
#image-modal {
    position: fixed; inset: 0; width: 100%; height: 100dvh;
    max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
    background: rgba(11,48,59,.95); color: white;
    opacity: 0; transition: opacity 200ms ease; overflow: hidden;
}
#image-modal:not([open]) { display: none; }
#image-modal[open] { display: flex; }
#image-modal.is-open { opacity: 1; }
#image-modal::backdrop { background: transparent; }
#close-image-modal {
    position: absolute; top: 16px; right: 16px; z-index: 1;
    width: 48px; height: 48px; border: 1px solid #ffffff55; border-radius: 50%;
    background: #0008; color: white; font-size: 24px; cursor: pointer;
}
#modal-img-container { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 64px 16px 16px; }
#modal-image { flex: none; max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; transform: translateY(8px); transition: transform 200ms ease; }
#image-modal.is-open #modal-image { transform: none; }
#image-modal.is-zoomed #modal-image { max-width: none; max-height: none; cursor: zoom-out; }
#image-modal.is-zoomed #modal-img-container { align-items: flex-start; justify-content: flex-start; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    #modal-image, .pic-hover-card:hover, .pic-btn:active, #mobile-menu-btn:active, .xp-playback button:active { transform: none; }
}

/* Reserve the image's final geometry before any bytes arrive. */
.pic-image {
    position: relative; display: block; isolation: isolate; overflow: hidden;
    aspect-ratio: var(--pic-ratio); background-color: #ffffff12;
}
.pic-image > img {
    position: absolute; inset: 0; display: block; width: 100%; height: 100%;
    max-width: 100%; object-fit: inherit; object-position: inherit;
    transition: opacity 180ms ease;
}
.pic-image-js .pic-image:not(.is-loaded) > img { opacity: 0; }
.pic-image-js .pic-image:not(.is-loaded):not(.is-error)::after {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, #ffffff24 50%, transparent 70%);
    transform: translateX(-100%); animation: pic-sheen 1.6s ease-in-out infinite;
}
@keyframes pic-sheen { to { transform: translateX(100%); } }
.pic-image-error {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    padding: .5rem; text-align: center; color: inherit; font: .75rem/1.4 var(--font-body);
}
.pic-image-error[hidden] { display: none; }
.pic-image.is-error { background-color: #ffffff12; }
@media (prefers-reduced-motion: reduce) {
    .pic-image-js .pic-image::after { animation: none; transform: none; background: #ffffff0a; }
    .pic-image > img { transition: none; }
}
/* The lightbox reserves the same ratio, constrained to the available viewport. */
#modal-img-container > .pic-modal-image {
    flex: none; width: min(100%, calc((100dvh - 80px) * var(--pic-ratio)));
    max-width: 100%; transform: translateY(8px); transition: transform 200ms ease;
}
#image-modal.is-open .pic-modal-image { transform: none; }
#image-modal .pic-modal-image > img { transform: none; max-height: none; }
#image-modal.is-zoomed .pic-modal-image { max-width: none; }
@media (prefers-reduced-motion: reduce) {
    #modal-img-container > .pic-modal-image { transform: none; transition: none; }
}

.pic-image:focus-within { outline: 3px solid currentColor; outline-offset: 4px; }
