/**
 * base.css - Layout, reset, typography and CSS variables used across the site.
 * Contains structure and layout only: box model, flex/grid, sizing, spacing.
 * No component colours, borders, or visual styling (those belong in components.css).
 */

* {
    box-sizing: border-box;
}

:root {
    /* Primary palette (holiday-planner blue) */
    --primary-colour: #0a3b7c;
    --primary-hover: #0d4a9f;
    --secondary-colour: #e0e0e0;
    --background: #FFFFFF;
    --text-colour: #000000;
    --text-alt: #FFFFFF;
    /* Shadows and overlays – use these instead of raw rgba in components */
    --shadow-very-subtle: rgba(0, 0, 0, 0.05);
    --shadow-subtle: rgba(0, 0, 0, 0.08);
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --overlay-dark: rgba(0, 0, 0, 0.8);
    --border-light: rgba(255, 255, 255, 0.2);
    /* Common button height for nav, segmented, dropdown, footer socials */
    --button-min-height: 44px;
    /* Single scaling rule for all controls (nav, segmented, dropdown, etc.) – no steps */
    --control-font-size: clamp(14px, 1.5vw, 16px);
}

/* Layout & reset */
html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

body {
    background: var(--background);
    color: var(--text-colour);
    margin: 0 auto;
    max-width: 1200px;
    min-height: 100vh;
    font-family: "Roboto", sans-serif;
    display: flex;
    flex-direction: column;
    font-size: clamp(14px, 2vw, 18px);
    padding-bottom: 80px; /* Space for cookie banner on mobile */
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
}

/* Text section – layout only */
.text-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8em;
    width: 100%;
    margin: 0;
    text-align: center;
    padding: 0 24px;
}

/* Media stack section – layout only */
.media-stack {
    position: relative;
    width: 100%;
    margin: 40px auto;
    min-height: 360px;
}

.media-stack-card {
    position: absolute;
    top: 0;
}


/* Page structure */
.page-wrapper {
    display: flex;
    flex: 1;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Applet template (layout)
 * Use on applet-style pages (holiday planner + finance tools):
 * <body class="applet-page"><div class="page-wrapper applet-shell">...<div class="applet-card">...</div></div></body> */
body.applet-page {
    background: var(--primary-colour);
    max-width: none;
    margin: 0;
}

.applet-shell {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px 24px;
    box-sizing: border-box;
    flex: 1;
}

/* Top navigation bar - structure and layout only (styling in components.css).
 * Break: container query on .top-nav-inner so two-line layout when segmented-button can no longer fit on one line. Logo is fixed size. */
.top-nav {
    width: 100%;
    max-width: 100vw;
    flex-shrink: 0;
    min-height: 60px;
    display: flex;
    align-items: center;
}

.top-nav-inner {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0 12px;
    gap: 12px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    container-type: inline-size;
    container-name: topnav;
}

/* Center the nav (segmented button): logo and spacer take equal space */
.top-nav-inner > .top-nav-logo {
    flex: 1 1 0;
    min-width: 0;
}

.top-nav-inner > .top-nav-links {
    flex: 0 0 auto;
}

.top-nav-spacer {
    flex: 1 1 0;
    min-width: 0;
}

.top-nav .top-nav-logo,
.top-nav .top-nav-links a:not(.dropdown-item),
.top-nav .top-nav-links .nav-link,
.top-nav .top-nav-links .nav-button,
.top-nav .top-nav-links .dropdown {
    padding: 0;
}

/* Exception: segment labels need padding. Same for all views (normal/inverted, web/mobile). */
.top-nav .top-nav-links .segmented-button .segmented-button-item .nav-button,
.top-nav .top-nav-links .segmented-button .segmented-button-item > a.nav-button,
.top-nav .top-nav-links .segmented-button a.segmented-button-item.nav-button {
    padding: 8px 14px;
}

.top-nav-logo {
    display: block;
    flex-shrink: 0;
}

.top-nav-logo img {
    display: block;
    height: 60px;
    width: auto;
    max-width: 200px;
    min-width: 0;
    object-fit: contain;
}

.top-nav-links {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 4px;
    padding-bottom: 4px;
}

.top-nav-links .dropdown {
    display: inline-block;
}

.top-nav-links .nav-button {
    min-height: var(--button-min-height);
    width: auto;
}

/* Segmented button - structure (styling in components.css) */
.segmented-button {
    display: inline-flex;
    align-items: stretch;
    flex-wrap: nowrap;
}

.segmented-button-item {
    flex: 0 0 auto;
}

.segmented-button-item .nav-button,
.segmented-button-item > a.nav-button,
a.segmented-button-item.nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-width: 0;
    box-sizing: border-box;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    overflow: visible;
    font-size: var(--control-font-size);
    font-weight: 500;
}

/* Two-line layout when nav no longer fits; logo and button centred. Segments always size to label (same as desktop). */
@container topnav (max-width: 500px) {
    .top-nav {
        padding-bottom: 12px;
    }
    .top-nav-inner {
        justify-content: center;
    }
    .top-nav-inner > .top-nav-logo {
        flex: 0 0 100%;
        width: 100%;
        display: flex;
        justify-content: center;
    }
    .top-nav-inner > .top-nav-links {
        flex-basis: 100%;
        min-width: 0;
        justify-content: center;
        margin-bottom: 12px;
    }
    .top-nav-spacer {
        display: none;
    }
    .segmented-button {
        min-width: 0;
        max-width: 100%;
    }
}

/* Main content area below nav */
.main-content-area {
    flex: 1;
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    background: var(--background);
}

.main-content {
    flex: 0 0 1170px;
    min-width: 0;
    max-width: 100vw;
}

.main-content-full {
    width: 100%;
    max-width: 100vw;
}

.right-column {
    flex: 1;
    background: var(--primary-colour);
}

.logo-column {
    padding: 20px;
    background: var(--primary-colour);
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.logo-header-centered {
    padding: 0;
    text-align: center;
    background: var(--primary-colour);
    position: relative;
    z-index: 1;
}

.logo-img {
    max-width: 200px;
    width: 100%;
    height: auto;
    display: block;
}

.logo-img-centered {
    max-width: 300px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Container */
.container {
    width: 100%;
    padding: 8px 15px;
    margin: 0 auto;
    max-width: 1140px;
    box-sizing: border-box;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Utilities (from minimal-bootstrap.css) */
.text-center {
    text-align: center !important;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

.mt-5 {
    margin-top: 3rem !important;
}

/* Typography */
h1 {
    font-size: clamp(22px, 4vw, 34px);
}

h2 {
    font-size: clamp(20px, 3vw, 26px);
}

h3 {
    font-size: clamp(18px, 2.5vw, 20.72px);
}

p {
    font-size: clamp(14px, 2vw, 18px);
}

/* Responsive layout */
@media (max-width: 1410px) {
    .page-wrapper {
        flex-direction: column;
    }
    .main-content {
        width: 100%;
        flex: 1;
    }
}

@media (max-width: 600px) {
    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    .page-wrapper {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    .main-content,
    .main-content-full {
        width: 100% !important;
        max-width: 100vw !important;
    }
    .container {
        width: 100% !important;
        max-width: 100vw !important;
    }
    .logo-img-centered {
        max-height: 150px;
        width: auto;
        height: auto;
    }
}
