/* =====================================================================
   SHARED SITE STYLES
   Tokens, surfaces, controls, and a few motifs used site-wide.

   Direction: deep ink-blue (derived from the brand #07304B), hairline
   structure instead of heavy boxes, one warm "solar" amber reserved for
   things that are waiting on you (approvals, pending changes).
===================================================================== */

/* ---------- Tokens ---------- */
:root {
    color-scheme: light;
    --sg-bg: #EDF2F6;
    --sg-bg-soft: #E5ECF1;
    --sg-panel: #FFFFFF;
    --sg-panel-2: #F5F8FA;
    --sg-hover: rgba(7, 48, 75, .06);
    --sg-field: #FFFFFF;
    --sg-line: rgba(7, 48, 75, .12);
    --sg-line-strong: rgba(7, 48, 75, .22);
    --sg-text: #0B2234;
    --sg-text-2: #3E5668;
    --sg-text-3: #647C8D;
    --sg-accent: #0D6FB8;
    --sg-accent-hover: #095A97;
    --sg-on-accent: #FFFFFF;
    --sg-accent-soft: rgba(13, 111, 184, .1);
    --sg-solar: #A56A00;
    --sg-solar-soft: rgba(217, 142, 18, .14);
    --sg-ok: #0C8A62;
    --sg-bad: #C23B3B;
    --sg-nav-bg: rgba(237, 242, 246, .86);
    --sg-veil-top: rgba(237, 242, 246, .86);
    --sg-veil-bottom: rgba(237, 242, 246, .97);
    --sg-shadow: 0 24px 60px -28px rgba(7, 48, 75, .35);
    --sg-radius-sm: 6px;
    --sg-radius: 10px;
    --sg-radius-lg: 14px;
    --sg-font-display: "Bricolage Grotesque", Inter, ui-sans-serif, system-ui, sans-serif;
}

.dark {
    color-scheme: dark;
    --sg-bg: #06121B;
    --sg-bg-soft: #081824;
    --sg-panel: #0A1B28;
    --sg-panel-2: #0E2434;
    --sg-hover: rgba(120, 170, 210, .09);
    --sg-field: rgba(2, 10, 16, .5);
    --sg-line: rgba(140, 185, 220, .13);
    --sg-line-strong: rgba(140, 185, 220, .25);
    --sg-text: #E7EFF5;
    --sg-text-2: #A8BCCB;
    --sg-text-3: #7C95A7;
    --sg-accent: #4DA9EE;
    --sg-accent-hover: #6DBBF6;
    --sg-on-accent: #04202F;
    --sg-accent-soft: rgba(77, 169, 238, .14);
    --sg-solar: #F6BE55;
    --sg-solar-soft: rgba(246, 190, 85, .14);
    --sg-ok: #4FD6A2;
    --sg-bad: #FF8484;
    --sg-nav-bg: rgba(6, 18, 27, .84);
    --sg-veil-top: rgba(6, 18, 27, .78);
    --sg-veil-bottom: rgba(6, 18, 27, .96);
    --sg-shadow: 0 28px 70px -30px rgba(0, 0, 0, .75);
}

/* ---------- Base ---------- */
html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--sg-bg);
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection {
    background: var(--sg-accent);
    color: var(--sg-on-accent);
}

:focus-visible {
    outline: 2px solid var(--sg-accent);
    outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: none;
}

h1, h2, h3, .font-display {
    font-family: var(--sg-font-display);
    font-optical-sizing: auto;
}

code, kbd, pre, samp {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--sg-line-strong) transparent;
}

/* ---------- Page backdrops ---------- */
/* Marketing pages: the campus photo, pushed far back under an ink veil. */
.sg-photo {
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image: var(--photo);
    background-position: center;
    background-size: cover;
    opacity: .55;
}

.sg-veil {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, var(--sg-veil-top) 0%, var(--sg-veil-bottom) 70%);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

/* Workspace pages: solid ink with one faint glow, so text stays the focus. */
.sg-ground {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(900px 480px at 8% -10%, rgba(77, 169, 238, .10), transparent 70%),
        var(--sg-bg);
}


html:not(.dark) .sg-ground {
    background:
        radial-gradient(900px 480px at 8% -10%, rgba(13, 111, 184, .08), transparent 70%),
        var(--sg-bg);
}

/* ---------- Navigation ---------- */
.glass-nav {
    background-color: var(--sg-nav-bg);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--sg-line);
}

.sg-brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--sg-text);
}

.sg-brand-mark {
    display: block;
    height: 26px;
    width: auto;
    object-fit: contain;
}

.sg-wordmark {
    font-family: var(--sg-font-display);
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -.02em;
    line-height: 1;
    color: var(--sg-text);
}

.sg-wordmark small {
    margin-left: .4rem;
    font-family: Inter, sans-serif;
    font-size: .78rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--sg-text-3);
}

.sg-navlink {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 56px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sg-text-2);
    transition: color .15s ease;
}

.sg-navlink:hover { color: var(--sg-text); }

.sg-navlink[aria-current="page"] { color: var(--sg-text); }

.sg-navlink[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--sg-accent);
}

.sg-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--sg-radius-sm);
    color: var(--sg-text-2);
    transition: background-color .15s ease, color .15s ease;
}

.sg-icon-btn:hover {
    background: var(--sg-hover);
    color: var(--sg-text);
}

.sg-menu {
    border: 1px solid var(--sg-line-strong);
    border-radius: var(--sg-radius);
    background: var(--sg-panel);
    box-shadow: var(--sg-shadow);
}

.copilot-brand-name {
    color: var(--sg-text);
    font-family: var(--sg-font-display);
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -.02em;
}

.copilot-brand-name > span {
    color: var(--sg-text-3);
    font-weight: 500;
}

/* ---------- Surfaces ---------- */
/* .glass-card is kept as the legacy name; it is now a flat, hairline panel. */
.glass-card,
.sg-panel {
    background: var(--sg-panel);
    border: 1px solid var(--sg-line);
    border-radius: var(--sg-radius);
    box-shadow: none;
}

.sg-rule { border-color: var(--sg-line); }

.sg-divide > * + * { border-top: 1px solid var(--sg-line); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    height: 38px;
    padding: 0 14px;
    border: 1px solid var(--sg-line-strong);
    border-radius: var(--sg-radius-sm);
    background: transparent;
    color: var(--sg-text);
    font-size: 13px;
    font-weight: 550;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn:hover { background: var(--sg-hover); border-color: var(--sg-text-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
    background: var(--sg-accent);
    border-color: var(--sg-accent);
    color: var(--sg-on-accent);
}

.btn-primary:hover {
    background: var(--sg-accent-hover);
    border-color: var(--sg-accent-hover);
}

.btn-lg { height: 46px; padding: 0 20px; font-size: 14px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }

/* Pill variant: softer, rounder calls to action */
.btn-pill {
    border-radius: 999px;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .3s ease, transform .3s cubic-bezier(.22, 1, .36, 1);
}
.btn-pill.btn-lg { padding: 0 26px; }
.btn-pill.btn-sm { padding: 0 14px; }
.btn-pill:hover { transform: translateY(-1px); }
.btn-pill.btn-primary {
    border-color: color-mix(in srgb, #fff 18%, var(--sg-accent));
    box-shadow: 0 14px 30px -16px var(--sg-accent), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn-pill.btn-primary:hover { box-shadow: 0 18px 34px -14px var(--sg-accent), inset 0 1px 0 rgba(255, 255, 255, .28); }

.btn-danger {
    border-color: color-mix(in srgb, var(--sg-bad) 45%, transparent);
    color: var(--sg-bad);
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--sg-bad) 12%, transparent);
    border-color: var(--sg-bad);
}

.btn-danger-solid {
    background: #B83232;
    border-color: #B83232;
    color: #fff;
}

.btn-danger-solid:hover { background: #CF3E3E; border-color: #CF3E3E; }

/* Text-style link used inside prose and panels. */
.sg-link {
    color: var(--sg-accent);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--sg-accent) 40%, transparent);
    text-underline-offset: 3px;
    transition: text-decoration-color .15s ease;
}

.sg-link:hover { text-decoration-color: var(--sg-accent); }

/* ---------- Form controls ---------- */
.field,
.agent-input {
    width: 100%;
    border: 1px solid var(--sg-line-strong);
    border-radius: var(--sg-radius-sm);
    background: var(--sg-field);
    color: var(--sg-text);
    font-size: 13px;
    line-height: 1.4;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field { height: 40px; padding: 0 12px; }
textarea.field { height: auto; padding: 10px 12px; }

.field::placeholder,
.agent-input::placeholder { color: var(--sg-text-3); }

.field:focus,
.agent-input:focus {
    outline: none;
    border-color: var(--sg-accent);
    box-shadow: 0 0 0 3px var(--sg-accent-soft);
}

.field:disabled,
.agent-input:disabled { opacity: .5; }

.field option,
.agent-input option {
    background: var(--sg-panel);
    color: var(--sg-text);
}

.field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 550;
    color: var(--sg-text);
}

.field-hint {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.55;
    color: var(--sg-text-3);
}

/* ---------- Small parts ---------- */
.tag {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    height: 22px;
    padding: 0 8px;
    border: 1px solid var(--sg-line-strong);
    border-radius: 999px;
    color: var(--sg-text-2);
    font-size: 11px;
    font-weight: 550;
    white-space: nowrap;
}

.tag-solar {
    border-color: color-mix(in srgb, var(--sg-solar) 40%, transparent);
    background: var(--sg-solar-soft);
    color: var(--sg-solar);
}

.tag-ok {
    border-color: color-mix(in srgb, var(--sg-ok) 40%, transparent);
    background: color-mix(in srgb, var(--sg-ok) 12%, transparent);
    color: var(--sg-ok);
}

.tag-accent {
    border-color: color-mix(in srgb, var(--sg-accent) 40%, transparent);
    background: var(--sg-accent-soft);
    color: var(--sg-accent);
}

.sg-icon-tile {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--sg-line);
    border-radius: var(--sg-radius-sm);
    background: var(--sg-panel-2);
    color: var(--sg-accent);
}

/* ---------- Review ticket (signature motif) ----------
   A change that is waiting on you carries a solar-amber edge. When it is
   approved the edge turns green. Used in the hero preview and in the
   commit-review dialog. */
.ticket {
    position: relative;
    border: 1px solid var(--sg-line-strong);
    border-radius: var(--sg-radius);
    background: var(--sg-panel);
    overflow: hidden;
}

.ticket::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--sg-solar);
    transition: background-color .4s ease;
}

.ticket[data-state="approved"]::before { background: var(--sg-ok); }

/* ---------- Motion ---------- */
/* Content is visible by default; reveal is kept only as a legacy hook. */
.reveal,
.reveal.active { opacity: 1; transform: none; }

/* One staged entrance, used by page heroes. */
.sg-rise {
    animation: sgRise .7s cubic-bezier(.16, 1, .3, 1) both;
    animation-delay: calc(var(--i, 0) * 90ms);
}

@keyframes sgRise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .sg-rise { animation: none; }
}

/* ---------- Legacy hooks kept for existing pages ---------- */
.ambient-glow {
    position: absolute;
    width: 760px;
    height: 760px;
    background: radial-gradient(circle, rgba(77, 169, 238, .12) 0%, rgba(0, 0, 0, 0) 62%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    filter: blur(60px);
}

.magnetic-wrapper {
    display: inline-block;
    perspective: 1000px;
}

.turnstile-challenge {
    max-height: 120px;
    overflow: hidden;
    opacity: 1;
    transform: scale(1);
    transform-origin: top center;
    transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.35s ease, margin 0.35s ease;
}

form.space-y-5 > .turnstile-challenge.is-verified {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
    transform: scale(0.97);
    pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
    .turnstile-challenge { transition: none; }
}


/* Page-to-page navigation: a short cross-fade instead of a flash (supported browsers only;
   others navigate normally). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: sgPageOut .16s ease-in both; }
::view-transition-new(root) { animation: sgPageIn .24s ease-out both; }
@keyframes sgPageOut { to { opacity: 0; } }
@keyframes sgPageIn { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    @view-transition { navigation: none; }
}


/* Profile photo: a round picture, or the person's initials. */
.sg-avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 2rem; height: 2rem; overflow: hidden; border-radius: 50%;
    background: var(--sg-accent-soft); color: var(--sg-accent); border: 1px solid var(--sg-line-strong); font-weight: 600; font-size: .72rem; letter-spacing: .02em; }
.sg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sg-avatar-sm { width: 1.7rem; height: 1.7rem; font-size: .62rem; }
.sg-avatar-md { width: 2.2rem; height: 2.2rem; font-size: .75rem; }
.sg-avatar-xl { width: 4rem; height: 4rem; font-size: 1.2rem; }
