/*
 * Shadow Companion authentication entrance.
 *
 * Shared by the unauthenticated /app screen and /auth/reset-password/. A light,
 * warm-white surface carrying the navy/gold brand: SC mark, serif title, the
 * 3-day free Taster offer, a prominent Google button, a navy email button and a
 * compact email form.
 *
 * Mobile-first, no motion beyond plain hover/focus colour changes. Every
 * interactive control is at least 48px tall.
 */
:root {
    --sc-entrance-bg: #fdfbf7;
    --sc-entrance-surface: #ffffff;
    --sc-navy: #0c1a3d;
    --sc-navy-hover: #142654;
    --sc-gold: #c9a227;
    --sc-gold-soft: rgba(201, 162, 39, 0.55);
    --sc-ink: #1d2740;
    --sc-body: #414a5c;
    --sc-muted: #5d6576;
    --sc-line: #e3ded3;
    --sc-field-border: #cfd3db;
    --sc-error: #a3262a;
    --sc-success: #1f6b3a;
    --sc-focus: #2b56c5;
    --sc-control-height: 52px;
    --sc-radius: 14px;
}

.sc-entrance {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(20px, env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
    background: var(--sc-entrance-bg);
    color: var(--sc-ink);
    font-family: var(--font-body, 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
}

.sc-entrance-card {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ── Brand ───────────────────────────────────────────────────────────── */

/* The logo artwork is a rounded SC square centred on a transparent field
   (the square spans ~22.6%–77.8% of the image). The frame reserves exactly the
   visible square (--sc-logo) in the layout and the image is positioned so the
   square fills it; the transparent margin overflows invisibly and never takes
   taps. The drop shadow follows the artwork's own rounded corners. */
.sc-entrance-logo {
    --sc-logo: 112px;
    position: relative;
    display: block;
    width: var(--sc-logo);
    height: var(--sc-logo);
    margin: 0 auto 18px;
    flex-shrink: 0;
}

.sc-entrance-logo img {
    position: absolute;
    width: calc(var(--sc-logo) * 1.812);
    height: calc(var(--sc-logo) * 1.812);
    max-width: none;
    left: calc(var(--sc-logo) * -0.411);
    top: calc(var(--sc-logo) * -0.392);
    display: block;
    pointer-events: none;
    filter: drop-shadow(0 8px 16px rgba(12, 26, 61, 0.2)) drop-shadow(0 2px 4px rgba(12, 26, 61, 0.12));
}

.sc-entrance-title {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 600;
    font-size: 2.35rem;
    line-height: 1.08;
    letter-spacing: 0.005em;
    color: var(--sc-navy);
    margin: 0 0 8px;
}

.sc-entrance-tagline {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-weight: 500;
    font-size: 1.3rem;
    line-height: 1.3;
    color: #6f5715;
    margin: 0 0 18px;
}

.sc-entrance-tagline::after {
    content: "";
    display: block;
    width: 36px;
    height: 1px;
    margin: 14px auto 0;
    background: var(--sc-gold-soft);
}

.sc-entrance-offer {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 700;
    font-size: 1.6rem;
    line-height: 1.15;
    letter-spacing: 0.005em;
    color: #000000;
    text-align: center;
    margin: 0;
}

/* The choice section is a 12px-gap column; these margins tighten the offer
   copy into one block and open a little space before the buttons. */
.sc-entrance-copy {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--sc-body);
    margin: -4px auto 0;
    max-width: 330px;
}

.sc-entrance-nocard {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--sc-ink);
    margin: -6px 0 8px;
}

/* ── Primary choice buttons ──────────────────────────────────────────── */

.sc-entrance-actions {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
}

.sc-entrance .sc-entrance-google.google-signin-btn {
    width: 100%;
    max-width: none;
    min-height: var(--sc-control-height);
    margin: 0;
    padding: 12px 20px;
    border-radius: var(--sc-radius);
    font-size: 1rem;
    font-weight: 500;
    color: #1f1f1f;
    background: #ffffff;
    border: 1px solid #d5d8de;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 2px 8px rgba(16, 24, 40, 0.06);
}

.sc-entrance .sc-entrance-google.google-signin-btn:hover {
    background: #f8f9fa;
    border-color: #c4c8cf;
}

.sc-entrance .sc-entrance-google .google-icon {
    width: 20px;
    height: 20px;
}

.sc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: var(--sc-control-height);
    padding: 12px 20px;
    border-radius: var(--sc-radius);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sc-btn-navy {
    color: #ffffff;
    background: var(--sc-navy);
    border: 1px solid var(--sc-navy);
    box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.55), 0 2px 8px rgba(12, 26, 61, 0.16);
}

.sc-btn-navy:hover { background: var(--sc-navy-hover); }

.sc-btn-navy svg { color: var(--sc-gold); flex-shrink: 0; }

.sc-btn-outline {
    color: var(--sc-navy);
    background: #ffffff;
    border: 1px solid var(--sc-gold-soft);
}

.sc-btn-outline:hover { background: #fbf7ec; }

.sc-btn:disabled,
.sc-btn[aria-disabled="true"] {
    opacity: 0.6;
    cursor: default;
}

.sc-btn:focus-visible,
.sc-link:focus-visible,
.sc-field input:focus-visible,
.sc-reveal:focus-visible,
.sc-entrance .google-signin-btn:focus-visible,
.sc-entrance-legal a:focus-visible {
    outline: 3px solid var(--sc-focus);
    outline-offset: 2px;
}

/* ── Inline text links ───────────────────────────────────────────────── */

.sc-switch {
    margin: 18px 0 0;
    font-size: 0.93rem;
    line-height: 1.5;
    color: var(--sc-muted);
}

.sc-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    margin: -12px 0;
    background: none;
    border: 0;
    font: inherit;
    font-weight: 600;
    color: var(--sc-navy);
    text-decoration: underline;
    text-decoration-color: var(--sc-gold);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.sc-link:hover { color: var(--sc-navy-hover); }

.sc-back {
    align-self: flex-start;
    margin: 0 0 6px -4px;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--sc-muted);
    gap: 6px;
}

/* ── Status line ─────────────────────────────────────────────────────── */

.sc-entrance .app-launch-status,
.sc-status {
    min-height: 1.2em;
    margin: 2px 0 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--sc-muted);
}

.sc-entrance .app-launch-status:empty { display: none; }

.sc-entrance .app-launch-status.auth-error,
.sc-status.is-error { color: var(--sc-error); }

.sc-status.is-success { color: var(--sc-success); }

/* ── Email panel / forms ─────────────────────────────────────────────── */

.sc-panel {
    width: 100%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
}

.sc-panel[hidden],
.sc-view[hidden],
.sc-entrance [hidden] { display: none !important; }

.sc-view {
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.sc-panel-title {
    font-family: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    font-weight: 600;
    font-size: 1.85rem;
    line-height: 1.15;
    color: var(--sc-navy);
    text-align: center;
    margin: 0 0 16px;
}

.sc-panel-text {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--sc-body);
    text-align: center;
    margin: 0 0 14px;
}

.sc-masked-email {
    display: block;
    font-weight: 600;
    color: var(--sc-ink);
    margin-top: 4px;
    word-break: break-all;
}

.sc-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
}

.sc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sc-field label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--sc-ink);
}

.sc-field-control {
    position: relative;
    display: flex;
}

.sc-field input {
    width: 100%;
    min-height: var(--sc-control-height);
    padding: 12px 14px;
    font-family: inherit;
    /* 16px prevents the mobile browser from zooming on focus. */
    font-size: 16px;
    color: var(--sc-ink);
    background: #ffffff;
    border: 1px solid var(--sc-field-border);
    border-radius: 12px;
    box-sizing: border-box;
    scroll-margin: 96px 0 160px;
    -webkit-appearance: none;
    appearance: none;
}

.sc-field input::placeholder { color: #8a909c; }

.sc-field input:focus { border-color: var(--sc-navy); outline: none; box-shadow: 0 0 0 3px rgba(12, 26, 61, 0.12); }

.sc-field input[aria-invalid="true"] { border-color: var(--sc-error); }

.sc-field-control input { padding-right: 76px; }

.sc-reveal {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 64px;
    min-height: 44px;
    padding: 0 10px;
    background: none;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sc-navy);
    cursor: pointer;
}

/* One fixed-height row under the password: the length hint while creating an
   account, "Forgot password?" while signing in. Same height in both modes so
   switching never shifts the layout. */
.sc-form-aside {
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: -4px;
    font-size: 0.85rem;
    color: var(--sc-muted);
}

.sc-form-aside .sc-link { font-size: 0.88rem; margin: -10px -4px; }

.sc-form .sc-btn { margin-top: 4px; }

.sc-panel .sc-switch { text-align: center; }

/* ── Legal footer ────────────────────────────────────────────────────── */

.sc-entrance-legal {
    margin: 22px 0 0;
    font-size: 0.82rem;
    color: var(--sc-muted);
}

.sc-entrance-legal a {
    display: inline-block;
    padding: 10px 2px;
    color: var(--sc-muted);
    text-decoration: underline;
    text-decoration-color: rgba(93, 101, 118, 0.4);
    text-underline-offset: 3px;
}

.sc-entrance-legal a:hover { color: var(--sc-navy); }

.sc-entrance-legal span { margin: 0 8px; opacity: 0.6; }

/* ── Compact brand while a form is open ──────────────────────────────── */

/* Forms sit from the top rather than the centre, so switching between Create
   account and Sign in (or a status line appearing) never moves the fields. */
.sc-entrance.is-form,
.sc-entrance:has(.sc-entrance-card.is-form) {
    align-items: flex-start;
    padding-top: max(28px, env(safe-area-inset-top));
}


.sc-entrance-card.is-form .sc-entrance-logo { --sc-logo: 76px; margin-bottom: 12px; }
.sc-entrance-card.is-form .sc-entrance-title { font-size: 1.6rem; margin-bottom: 18px; }
.sc-entrance-card.is-form .sc-entrance-tagline,
.sc-entrance-card.is-form .sc-entrance-offer,
.sc-entrance-card.is-form .sc-entrance-copy,
.sc-entrance-card.is-form .sc-entrance-nocard { display: none; }

/* ── Simplified authentication entrance ──────────────────────────────── */

/* html.sc-returning is the default entrance, set aside only for the introduction:
   just the brand, the two sign-in buttons, "New here? Get started" and the
   legal links. The brand + buttons group is centred in the space above the
   footer, which sits near the bottom of the screen. */
.sc-tagline-returning,
.sc-switch-new { display: none; }

html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-offer,
html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-copy,
html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-nocard,
html.sc-returning .sc-entrance-card:not(.is-form) .sc-intro-taster,
html.sc-returning .sc-entrance-card:not(.is-form) .app-launch-guest { display: none !important; }

html.sc-returning .sc-entrance-card:not(.is-form) .sc-tagline-returning { display: inline; }
html.sc-returning .sc-entrance-card:not(.is-form) .sc-switch-new { display: block; }

html.sc-returning .sc-entrance:not(.is-form) { align-items: stretch; }

html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-logo { margin-top: auto; }
html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-tagline { margin-bottom: 32px; }
html.sc-returning .sc-entrance-card:not(.is-form) .sc-switch-new { margin-top: 22px; }
html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-legal {
    margin-top: auto;
    padding-top: 28px;
}

/* ── Short / narrow screens ──────────────────────────────────────────── */

@media (max-height: 700px) {
    .sc-entrance-logo { --sc-logo: 92px; margin-bottom: 14px; }
    .sc-entrance-title { font-size: 2.1rem; }
    .sc-entrance-tagline { margin-bottom: 12px; }
    .sc-entrance-tagline::after { margin-top: 10px; }
    .sc-entrance-offer { font-size: 1.45rem; }
    .sc-entrance-nocard { margin-bottom: 4px; }
    .sc-entrance-legal { margin-top: 16px; }
    html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-tagline { margin-bottom: 24px; }
    html.sc-returning .sc-entrance-card:not(.is-form) .sc-entrance-legal { padding-top: 20px; }
}

@media (max-height: 600px) {
    .sc-entrance-logo { --sc-logo: 72px; margin-bottom: 10px; }
    .sc-entrance-title { font-size: 1.9rem; }
    .sc-entrance-offer { font-size: 1.35rem; }
    .sc-entrance-copy { font-size: 0.9rem; }
    .sc-switch { margin-top: 12px; }
    .sc-entrance-card.is-form .sc-entrance-logo { --sc-logo: 56px; }
}

@media (max-width: 340px) {
    .sc-entrance { padding-left: 16px; padding-right: 16px; }
    .sc-entrance-title { font-size: 2rem; }
}

@media (min-width: 600px) {
    .sc-entrance-logo { --sc-logo: 124px; }
    .sc-entrance-title { font-size: 2.65rem; }
}

@media (min-width: 600px) and (max-height: 700px) {
    .sc-entrance-logo { --sc-logo: 92px; }
}

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

/* Headings take programmatic focus only so screen readers announce a new
   view; they are not interactive and need no focus ring. */
.sc-panel-title:focus { outline: none; }
