@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../assets/fonts/PlusJakartaSans-Variable.ttf") format("truetype");
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
}

:root {
    --color-canvas: #f6f7f4;
    --color-surface: #ffffff;
    --color-ink: #1c1917;
    --color-text: #57534e;
    --color-muted: #566059;
    --color-quiet: #566059;
    --color-border: #e7e5e4;
    --color-separator: #f0eeeb;
    --color-logo-green: #0c5700;
    --color-logo-yellow: #e5f200;
    --color-accent: var(--color-logo-green);
    --color-accent-hover: #084500;
    --color-accent-soft: #f2f8ef;
    --color-accent-border: #b8d5b3;
    --color-gold-soft: #fcffd6;
    --color-gold-border: #e5ea7c;
    --color-selected-soft: #fdffd1;
    --color-selected-border: #d8de55;
    --color-panel: #f5f5f4;
    --color-panel-warm: #f1f6ec;
    --color-danger: #b91c1c;
    --color-danger-soft: #fef2f2;
    --color-danger-border: #fecaca;
    --color-success: #166534;
    --color-success-soft: #f0fdf4;
    --color-success-border: #bbf7d0;
    --color-info: #1d4ed8;
    --color-info-soft: #eff6ff;
    --color-info-border: #bfdbfe;
    --color-warning: #92400e;
    --color-warning-soft: #fffbeb;
    --color-warning-border: #fde68a;
    --font-sans: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --text-10: 0.625rem;
    --text-11: 0.6875rem;
    --text-12: 0.75rem;
    --text-13: 0.8125rem;
    --text-14: 0.875rem;
    --text-16: 1rem;
    --text-20: 1.25rem;
    --text-24: 1.5rem;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-2-5: 0.625rem;
    --space-3: 0.75rem;
    --space-3-5: 0.875rem;
    --space-4: 1rem;
    --space-5-5: 1.375rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --radius-control: 8px;
    --radius-card: 12px;
    --radius-pill: 999px;
    --topbar-height: 56px;
    --rail-width: 240px;
    --content-width: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }

/* Use the portal's own password visibility button instead of Edge's built-in one. */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear { display: none; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--topbar-height) + var(--space-4));
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #2e7d32 #edf3eb;
    overflow-x: clip;
    background: var(--color-canvas);
}

* { scrollbar-width: thin; scrollbar-color: #2e7d32 #edf3eb; }

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    overflow-x: clip;
    background: transparent;
    color: var(--color-ink);
    font-family: var(--font-sans);
    font-size: var(--text-14);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
#app-container { flex: 1 0 auto; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #edf3eb; }
::-webkit-scrollbar-thumb {
    border: 2px solid #edf3eb;
    border-radius: 999px;
    background-color: #2e7d32;
}
::-webkit-scrollbar-thumb:hover { background-color: #0c5700; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { color: var(--color-ink); letter-spacing: -.025em; line-height: 1.2; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
h2 { font-size: var(--text-20); }
h3 { font-size: var(--text-16); }
p { color: var(--color-text); }

:focus-visible {
    outline: 3px solid rgba(12, 87, 0, .35);
    outline-offset: 2px;
}

[tabindex="-1"]:focus { outline: none; }

.skip-link {
    position: fixed;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 5000;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-control);
    background: var(--color-ink);
    color: var(--color-surface);
    font-weight: 700;
    transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: var(--topbar-height);
    border-bottom: 1px solid transparent;
    background: #fff;
    box-shadow: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.navbar.is-scrolled { border-bottom-color: var(--color-border); box-shadow: 0 2px 10px rgba(28, 25, 23, .08); }
.nav-inner {
    display: flex;
    align-items: center;
    width: min(100%, 1120px);
    margin: 0 auto;
    padding-right: 24px;
    padding-left: 24px;
    box-sizing: border-box;
    min-height: var(--topbar-height);
}
.portal-main-row { display: contents; }
.logo-container {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2-5);
    min-width: 0;
    color: inherit;
    text-align: left;
    text-decoration: none;
}
.brand-button { padding: 0; border: 0; background: transparent; }
.logo { width: 34px; height: 34px; flex: 0 0 auto; object-fit: cover; border-radius: 50%; }
.logo-text { display: flex; min-width: 0; flex-direction: column; line-height: 1.25; }
.logo-text strong { font-size: var(--text-13); font-weight: 800; letter-spacing: -.01em; }
.logo-text span { overflow: hidden; color: var(--color-muted); font-size: var(--text-10); text-overflow: ellipsis; white-space: nowrap; }
.nav-menu { display: flex; align-items: center; justify-content: flex-end; flex: 1; min-width: 0; }
.nav-links { display: flex; align-items: center; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.nav-links button, .nav-return {
    min-height: 36px;
    padding: var(--space-2) var(--space-3);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text);
    font-size: var(--text-12);
    font-weight: 600;
    text-decoration: none;
}
.nav-links button:hover, .nav-return:hover {
    border-color: var(--color-accent-border);
    background: var(--color-accent-soft);
    color: var(--color-accent-hover);
}
.nav-links button[aria-current="page"] {
    border-color: var(--color-accent-border);
    background: var(--color-accent-soft);
    color: var(--color-accent-hover);
}
.user-info { position: relative; display: flex; align-items: center; gap: var(--space-3); margin-left: var(--space-4); padding-left: var(--space-4); border-left: 1px solid var(--color-border); }
#welcome-user { display: inline-flex; max-width: 190px; align-items: center; gap: 8px; padding: 8px 4px; border: 0; background: transparent; color: var(--color-text); font-family: inherit; font-size: var(--text-12); font-weight: 600; white-space: nowrap; cursor: pointer; }
#welcome-user span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
#welcome-user:hover { color: var(--color-accent-hover); }
#welcome-user:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; border-radius: 10px; }
#welcome-user i { font-size: 10px; transition: transform .16s ease; }
#welcome-user[aria-expanded="true"] i { transform: rotate(180deg); }
.account-avatar { display: none; }
.user-account-menu { position: absolute; z-index: 1200; top: calc(100% + 8px); right: 0; display: grid; width: 260px; min-width: 240px; max-width: calc(100vw - 32px); box-sizing: border-box; gap: 0; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); box-shadow: 0 10px 24px rgba(28, 25, 23, .14); }
.user-account-menu[hidden] { display: none; }
.user-account-menu:not([hidden]) { animation: account-menu-enter .16s ease-out both; }
.account-menu-summary { min-width: 0; padding: 8px 12px 10px; }
.account-menu-summary strong,
.account-menu-summary span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-summary strong { color: var(--color-ink); font-size: var(--text-12); font-weight: 700; }
.account-menu-summary span { margin-top: 3px; color: var(--color-muted); font-size: var(--text-11); }
.account-menu-divider { height: 0; margin: 2px 4px 6px; border-top: 1px solid var(--color-separator); }
.account-menu-logout-divider { margin: 6px 4px 4px; }
.user-account-menu .account-menu-item { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--color-text); font: inherit; font-size: var(--text-12); font-weight: 600; text-align: left; white-space: nowrap; cursor: pointer; transition: background-color .14s ease, color .14s ease; }
.user-account-menu .account-menu-item i { width: 16px; color: currentColor; text-align: center; }
.user-account-menu .account-menu-item:hover { background: var(--color-accent-soft); color: var(--color-accent-hover); }
.user-account-menu .account-menu-item:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.user-account-menu .account-menu-logout:hover { background: #fff0ef; color: #a3433b; }
@keyframes account-menu-enter { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 767px) {
    #welcome-user .account-greeting { display: none; }
    #welcome-user .account-avatar { position: relative; display: grid; width: 34px; height: 34px; max-width: none; place-items: center; overflow: hidden; border-radius: 50%; background: #e3e4e8; color: transparent; font-size: 0; text-overflow: clip; }
    #welcome-user .account-avatar::before { position: absolute; top: 6px; left: 50%; width: 11px; height: 12px; border-radius: 50%; background: #707477; content: ""; transform: translateX(-50%); }
    #welcome-user .account-avatar::after { position: absolute; right: 4px; bottom: 0; left: 4px; height: 13px; border-radius: 48% 48% 0 0 / 72% 72% 0 0; background: #707477; content: ""; }
    .user-account-menu { min-width: min(240px, calc(100vw - 32px)); max-width: calc(100vw - 32px); }
}
.nav-toggle { display: none; align-items: center; gap: var(--space-2); min-height: 40px; margin-left: auto; padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface); color: var(--color-ink); font-size: var(--text-12); font-weight: 700; }
.category-nav { margin-left: auto; }
#main-nav.hidden-nav { display: none; }

.section { display: none; min-height: calc(100vh - var(--topbar-height)); }
.section.active { display: block; animation: page-enter .34s cubic-bezier(.22, .61, .36, 1) both; }
body[data-route-styles-pending] #app-container,
.section[data-route-styles-pending] { visibility: hidden !important; }
.auth-section.active { display: flex; min-height: 100vh; animation: page-enter .34s cubic-bezier(.22, .61, .36, 1) both; }

/* Verification and password-reset URLs arrive with query parameters rather
   than a hash, so render their destination while the app processes the token. */
body[data-entry-route="verification"] #landing,
body[data-entry-route="password-reset"] #landing { display: none; }
body[data-entry-route="verification"] #login { display: flex; min-height: 100vh; animation: page-enter .34s cubic-bezier(.22, .61, .36, 1) both; }
body[data-entry-route="password-reset"] #forgot-password { display: flex; min-height: 100vh; animation: page-enter .34s cubic-bezier(.22, .61, .36, 1) both; }
body[data-entry-route="verification"] #main-nav,
body[data-entry-route="password-reset"] #main-nav { display: none; }
/* The tiny route boot script runs at the start of <body>, before any section
   markup, so the URL's page is the first one painted for every portal route. */
body[data-route-start] .section { display: none; animation: none; }
body[data-route-start="landing"] #landing,
body[data-route-start="bulletin"] #bulletin,
body[data-route-start="resident-dashboard"] #resident-dashboard,
body[data-route-start="admin-dashboard"] #admin-dashboard,
body[data-route-start="privacy-policy"] #privacy-policy,
body[data-route-start="terms"] #terms,
body[data-route-start="moderation"] #moderation,
body[data-route-start="copyright"] #copyright { display: block; animation: page-enter .34s cubic-bezier(.22, .61, .36, 1) both; }
body[data-route-start="login"] #login,
body[data-route-start="admin-login"] #admin-login,
body[data-route-start="forgot-password"] #forgot-password,
body[data-route-start="resident-change-email"] #resident-change-email,
body[data-route-start="resident-change-password"] #resident-change-password { display: flex; animation: page-enter .34s cubic-bezier(.22, .61, .36, 1) both; }
/* Keep registration's first paint on the same single section animation as
   navigation; separate panel animations made the form and brand enter apart. */
body[data-route-start="register"] #register { display: flex; animation: page-enter .34s cubic-bezier(.22, .61, .36, 1) both; }
body[data-route-start="login"] #main-nav,
body[data-route-start="admin-login"] #main-nav,
body[data-route-start="forgot-password"] #main-nav,
body[data-route-start="resident-change-email"] #main-nav,
body[data-route-start="resident-change-password"] #main-nav,
body[data-route-start="register"] #main-nav { display: none; }

/* #landing has its own higher-specificity layout rule in home.css. Explicitly
   suppress it for every other boot route, then let normal .active classes own
   navigation after showSection() removes data-route-start. */
body[data-route-start]:not([data-route-start="landing"]) #landing { display: none; }

@keyframes page-enter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.page-shell { width: min(100%, var(--content-width)); margin: 0 auto; padding: var(--space-8) 32px var(--space-10); }
.eyebrow, .step-label {
    margin-bottom: var(--space-2);
    color: var(--color-accent);
    font-size: var(--text-10);
    font-weight: 800;
    letter-spacing: .12em;
    line-height: 1.3;
    text-transform: uppercase;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background: var(--color-canvas);
}

/* Shared error-screen layout is in unavailable.css for standalone and in-app 404s. */
html.hide-unavailable-scrollbar { scrollbar-width: none; scrollbar-gutter: auto; -ms-overflow-style: none; background: #fff; }
html.hide-unavailable-scrollbar::-webkit-scrollbar,
body.unavailable-view::-webkit-scrollbar { display: none; width: 0; height: 0; }
body.unavailable-view #policy-back-top,
body.unavailable-view .skip-link { display: none !important; }
body.unavailable-view { display: block; border: 0; background: #fff; }
body.unavailable-view #app-container { width: 100%; max-width: none; margin: 0; }

#landing { position: relative; isolation: isolate; overflow: hidden; min-height: 0; }
