/* =====================================================================
   theme.css  -  the shared look of the whole website
   Se-Ri's Choice Enterprise (Elective 2 project, Elaiza & Andrea)
   ---------------------------------------------------------------------
   The idea: every page looks like a cute pastel computer desktop,
   and every box is a "window" with a title bar.

    1. Colours, fonts and shapes (CSS variables)  <- change the look here
    2. Basics (page, text, links, keyboard focus)
    3. Desktop background
    4. Windows (boxes with a title bar)
    5. Buttons
    6. Form fields
    7. Messages (alerts and toasts)
    8. Loading screen
    9. Decorations and animations
   10. Page transitions
   11. Section themes: pink = Elaiza's products, blue = Andrea's products
   12. Helpers
   13. Reduced motion (for people who turn animations off)
   ===================================================================== */


/* 1. COLOURS, FONTS AND SHAPES ---------------------------------------- */
:root {
    /* pastel pink */
    --pink-50:  #FFF5F9;
    --pink-100: #FFE4EF;
    --pink-200: #FFC9DE;
    --pink-300: #FFA9CA;
    --pink-500: #E9679C;
    --pink-700: #B83C72;   /* dark enough for text on white */

    /* pastel blue */
    --blue-50:  #F3F9FF;
    --blue-100: #E0F0FF;
    --blue-200: #C2E2FF;
    --blue-300: #9CCDFA;
    --blue-500: #5B9FE3;
    --blue-700: #2F6DB0;   /* dark enough for text on white */

    /* soft extras */
    --lav-100: #F1EBFF;
    --lav-200: #E4D9FF;
    --butter:  #FFF0B3;
    --rose:    #FFD6DF;    /* error messages */
    --mint:    #D2F5E8;    /* success messages */
    --white:   #FFFFFF;

    /* text and outlines */
    --ink:      #4A3A66;   /* main text: deep plum instead of black */
    --ink-soft: #6E5F8A;   /* secondary text */
    --line:     #6E5F8A;   /* window and button outlines */

    /* the colour pair of a page; sections swap these (see part 11) */
    --main:         var(--pink-200);
    --main-strong:  var(--pink-300);
    --accent:       var(--blue-200);
    --accent-strong: var(--blue-300);

    /* fonts: pixel letters for titles, round letters for reading */
    --font-pixel: 'Pixelify Sans', 'Courier New', monospace;
    --font-body:  'M PLUS Rounded 1c', 'Segoe UI', 'Trebuchet MS', sans-serif;

    /* shapes */
    --border:        2px solid var(--line);
    --radius-window: 14px;
    --radius-field:  12px;
    --radius-pill:   999px;
    --shadow-pink:   6px 6px 0 var(--pink-300);   /* hard "sticker" shadows */
    --shadow-blue:   6px 6px 0 var(--blue-300);
}


/* 2. BASICS ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--ink);
    background: var(--pink-50);
}

h1, h2, h3 {
    margin: 0 0 .5em;
    font-family: var(--font-pixel);
    font-weight: 600;
    line-height: 1.15;
}

p { margin: 0 0 1em; }

a { color: var(--pink-700); text-underline-offset: 3px; }
a:hover { color: var(--blue-700); }

img { max-width: 100%; }

/* a clear outline for people who use the keyboard (Tab key) */
:focus-visible {
    outline: 3px dashed var(--blue-700);
    outline-offset: 3px;
}


/* 3. DESKTOP BACKGROUND ------------------------------------------------- */
/* pink at the top, blue at the bottom, with a faint graph-paper grid */
.desktop {
    background-color: var(--lav-100);
    background-image:
        linear-gradient(rgba(255, 255, 255, .55) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .55) 1px, transparent 1px),
        linear-gradient(165deg, #FFDDEB 0%, #F1E6FF 50%, #D6EBFF 100%);
    background-size: 28px 28px, 28px 28px, 100% 100%;
}


/* 4. WINDOWS ------------------------------------------------------------ */
.window {
    position: relative;
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius-window);
    box-shadow: var(--shadow-blue);
}

.window.shadow-pink { box-shadow: var(--shadow-pink); }

/* the title bar fades from pink to blue, like a retro computer window */
.window-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 6px 12px;
    background: linear-gradient(90deg, var(--pink-200), var(--lav-200) 55%, var(--blue-200));
    border-bottom: var(--border);
    border-radius: calc(var(--radius-window) - 2px) calc(var(--radius-window) - 2px) 0 0;
    font-family: var(--font-pixel);
    font-size: 15px;
    font-weight: 500;
}

.window-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.window-title img { width: 18px; height: auto; }

/* the three little buttons: minimise, maximise, close (drawn with CSS) */
.window-controls { display: inline-flex; gap: 5px; }

.window-controls > span {
    position: relative;
    width: 22px;
    height: 22px;
    background: var(--white);
    border: var(--border);
    border-radius: 6px;
}

.ctrl-min::before {
    content: "";
    position: absolute;
    left: 4px; right: 4px; bottom: 4px;
    height: 3px;
    background: var(--ink);
}

.ctrl-max::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 2px solid var(--ink);
    border-top-width: 3px;
}

.ctrl-close::before,
.ctrl-close::after {
    content: "";
    position: absolute;
    left: 3px; right: 3px; top: 8px;
    height: 3px;
    background: var(--ink);
    transform: rotate(45deg);
}

.ctrl-close::after { transform: rotate(-45deg); }

.ctrl-close[data-close] { cursor: pointer; }
.ctrl-close[data-close]:hover { background: var(--pink-200); }

.window-body { padding: 24px; }


/* 5. BUTTONS ------------------------------------------------------------ */
/* Buttons look like chunky retro keys: they lift on hover and press down on click. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 24px;
    font-family: var(--font-pixel);
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
    color: var(--ink);
    text-decoration: none;
    background: var(--main);
    border: var(--border);
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 0 var(--line);
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background-color .2s ease;
}

.btn:hover {
    color: var(--ink);
    background: var(--main-strong);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--line);
}

.btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--line);
}

.btn img { width: 18px; height: auto; }

.btn-pink  { --main: var(--pink-200); --main-strong: var(--pink-300); }
.btn-blue  { --main: var(--blue-200); --main-strong: var(--blue-300); }
.btn-white { --main: var(--white);    --main-strong: var(--lav-100); }

/* pink-to-blue candy button, for the most important action on a page */
.btn-candy { background: linear-gradient(90deg, var(--pink-200), var(--lav-200), var(--blue-200)); }
.btn-candy:hover { background: linear-gradient(90deg, var(--pink-300), var(--lav-200), var(--blue-300)); }


/* 6. FORM FIELDS -------------------------------------------------------- */
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field label {
    font-size: 14px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px 14px;
    font: inherit;
    color: var(--ink);
    background: var(--white);
    border: var(--border);
    border-radius: var(--radius-field);
    transition: box-shadow .15s ease, border-color .15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--blue-700);
    box-shadow: 0 0 0 4px var(--blue-200);
}

/* boxes the computer fills in (like Gross Income) */
.field input[readonly] {
    color: var(--ink);
    background: var(--lav-100);
    border-style: dashed;
}

::placeholder { color: var(--ink-soft); opacity: 1; }


/* 7. MESSAGES ----------------------------------------------------------- */
.alert {
    margin: 0 0 16px;
    padding: 10px 14px;
    font-size: 15px;
    font-weight: 700;
    text-align: left;
    border: var(--border);
    border-radius: var(--radius-field);
}

.alert-error   { background: var(--rose); animation: shake .45s ease 1; }
.alert-success { background: var(--mint); }
.alert-info    { background: var(--blue-100); }

/* toast = a small pop-up window that closes by itself.
   Like a computer notification, it appears above the taskbar clock. */
.toast {
    position: fixed;
    right: 18px;
    bottom: 76px;
    z-index: 50;
    width: min(320px, calc(100% - 36px));
    background: var(--white);
    border: var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-pink);
    animation: toast-in .45s cubic-bezier(.2, 1.4, .4, 1) both;
}

.toast .window-titlebar { padding: 4px 6px 4px 10px; font-size: 13px; }
.toast-body { margin: 0; padding: 12px 14px; font-size: 15px; }
.toast.closing { animation: toast-out .35s ease forwards; }


/* 8. LOADING SCREEN ----------------------------------------------------- */
/* Shown on the first page of a visit, then it fades away (see effects.js). */
.loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 16px;
    background: linear-gradient(165deg, var(--pink-100), var(--lav-100), var(--blue-100));
    animation: loader-hide .4s ease 3s forwards;   /* safety net if JavaScript is off */
}

.booted .loader { display: none; }
.loader.loader-done { animation: loader-hide .45s ease forwards; }

.loader-heart {
    width: 72px;
    animation: heartbeat 1s ease-in-out infinite;
}

.loader-text {
    margin: 0;
    font-family: var(--font-pixel);
    font-size: 20px;
}

.loader-bar {
    width: 240px;
    height: 22px;
    padding: 3px;
    background: var(--white);
    border: var(--border);
    border-radius: 8px;
    overflow: hidden;
}

/* the bar fills in chunky steps with pink and blue stripes */
.loader-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 4px;
    background: repeating-linear-gradient(90deg, var(--pink-300) 0 12px, var(--blue-300) 12px 24px);
    animation: load-fill 1.2s steps(10) forwards;
}


/* 9. DECORATIONS AND ANIMATIONS ---------------------------------------- */
.sky {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.sky img { position: absolute; }

.cloud { width: 150px; opacity: .95; animation: drift 80s linear infinite; }
.sparkle { width: 26px; animation: twinkle 2.8s ease-in-out infinite; }

@keyframes drift     { from { transform: translateX(-25vw); } to { transform: translateX(125vw); } }
@keyframes twinkle   { 0%, 100% { transform: scale(.6) rotate(0); opacity: .45; }
                       50%      { transform: scale(1) rotate(20deg); opacity: 1; } }
@keyframes float     { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes bob       { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px); } 70% { transform: translateY(1px); } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); }
                       30% { transform: scale(1); } 45% { transform: scale(1.1); } }
@keyframes pop-in    { 0% { opacity: 0; transform: scale(.85) translateY(14px); }
                       70% { opacity: 1; transform: scale(1.02); }
                       100% { opacity: 1; transform: scale(1); } }
@keyframes pop-out   { to { opacity: 0; transform: scale(.8); } }
@keyframes shake     { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-6px); }
                       40%, 80% { transform: translateX(6px); } }
@keyframes toast-in  { from { opacity: 0; transform: translateY(16px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px) scale(.95); } }
@keyframes load-fill { to { width: 100%; } }
@keyframes loader-hide { to { opacity: 0; visibility: hidden; } }


/* 10. PAGE TRANSITIONS ------------------------------------------------- */
/* The page content fades in; effects.js adds .page-leaving before going to another page. */
.page { animation: page-in .45s ease both; }
.page-leaving .page { animation: page-out .22s ease forwards; }

@keyframes page-in  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes page-out { to { opacity: 0; transform: translateY(-6px); } }


/* 11. SECTION THEMES (used by the store pages in Phase 6) -------------- */
/* Same layout for both sections; only the main colour changes. */
.theme-pink {
    --main: var(--pink-200);  --main-strong: var(--pink-300);
    --accent: var(--blue-200); --accent-strong: var(--blue-300);
}
.theme-pink .window { box-shadow: var(--shadow-pink); }
.theme-pink .window-titlebar { background: linear-gradient(90deg, var(--pink-200), var(--pink-100) 70%, var(--blue-100)); }

.theme-blue {
    --main: var(--blue-200);  --main-strong: var(--blue-300);
    --accent: var(--pink-200); --accent-strong: var(--pink-300);
}
.theme-blue .window { box-shadow: var(--shadow-blue); }
.theme-blue .window-titlebar { background: linear-gradient(90deg, var(--blue-200), var(--blue-100) 70%, var(--pink-100)); }


/* 12. HELPERS ---------------------------------------------------------- */
/* small pixel heart that sits inside a line of text */
.inline-heart { width: 16px; height: auto; vertical-align: -2px; }

/* hides text on screen but keeps it for screen readers */
.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;
}


/* 13. REDUCED MOTION --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .loader { display: none; }
}
