@import url("./fonts.css");

:root {
    color-scheme: light;
    font-family: var(--font-family-base);

    --auth-bg: #f5f7fa;
    --auth-surface: #ffffff;
    --auth-surface-sub: #fbfcfe;
    --auth-surface-muted: #f3f6fa;
    --auth-text: #18212f;
    --auth-text-strong: #243247;
    --auth-muted: #657184;
    --auth-muted-soft: #7a8798;
    --auth-border: #dce3ec;
    --auth-border-soft: #e0e6ee;
    --auth-input-border: #cfd8e4;
    --auth-control-border: #9eacbd;
    --auth-primary: #4779c6;
    --auth-link: #315f9f;
    --auth-brand-bg: #18212f;
    --auth-brand-text: #ffffff;
    --auth-danger: #b42318;
    --auth-danger-bg: #fff1ef;
    --auth-danger-border: #f3c7c1;
    --auth-warning: #9a5b00;
    --auth-warning-bg: #fff4dd;
    --auth-warning-border: #f0d295;
    --auth-success: #18794e;
    --auth-success-bg: #eaf7f0;
    --auth-success-border: #b9e0ca;
    --auth-glow: rgba(32, 90, 180, 0.10);
    --auth-focus-ring: rgba(71, 121, 198, 0.14);
    --auth-selected-bg: #f2f6fc;
    --auth-shadow: 0 18px 50px rgba(26, 39, 58, 0.10);
}

html[data-theme="dark"] {
    color-scheme: dark;

    --auth-bg: #0d1117;
    --auth-surface: #141922;
    --auth-surface-sub: #1a202b;
    --auth-surface-muted: #171d26;
    --auth-text: #edf2f8;
    --auth-text-strong: #edf2f8;
    --auth-muted: #a1adbd;
    --auth-muted-soft: #8e99aa;
    --auth-border: #303846;
    --auth-border-soft: #2a323e;
    --auth-input-border: #3a4453;
    --auth-control-border: #536071;
    --auth-primary: #7899ff;
    --auth-link: #9ab2ff;
    --auth-brand-bg: #607fff;
    --auth-brand-text: #ffffff;
    --auth-danger: #ff9a9a;
    --auth-danger-bg: #3b2024;
    --auth-danger-border: #6a343a;
    --auth-warning: #ffd078;
    --auth-warning-bg: #3a2b13;
    --auth-warning-border: #674b1c;
    --auth-success: #74d99a;
    --auth-success-bg: #173627;
    --auth-success-border: #285942;
    --auth-glow: rgba(111, 140, 255, 0.12);
    --auth-focus-ring: rgba(120, 153, 255, 0.20);
    --auth-selected-bg: #1e2a3d;
    --auth-shadow: 0 18px 52px rgba(0, 0, 0, 0.30);
}

* {
    box-sizing: border-box;
}

html,
body.auth-page {
    background: var(--auth-bg);
    color: var(--auth-text);
}

body.auth-page {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, var(--auth-glow), transparent 34rem),
        var(--auth-bg);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(100%, 430px);
    padding: 36px;
    border: 1px solid var(--auth-border);
    border-radius: 18px;
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow);
}

.auth-brand {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    margin-bottom: 24px;
    border-radius: 14px;
    background: var(--auth-brand-bg);
    color: var(--auth-brand-text);
    font-size: 22px;
    font-weight: 800;
}

.auth-heading {
    margin-bottom: 28px;
}

.auth-heading h1 {
    margin: 4px 0 8px;
    color: var(--auth-text);
    font-size: 26px;
    line-height: 1.25;
}

.auth-heading p {
    margin: 0;
    color: var(--auth-muted);
    line-height: 1.55;
}

.auth-heading .auth-eyebrow {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--auth-text-strong);
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-field {
    display: grid;
    gap: 8px;
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 650;
}

.auth-field input,
.auth-field textarea {
    width: 100%;
    border: 1px solid var(--auth-input-border);
    border-radius: 10px;
    background: var(--auth-surface);
    color: var(--auth-text);
    font: inherit;
    outline: none;
}

.auth-field input {
    min-height: 46px;
    padding: 10px 13px;
}

.auth-field input::placeholder,
.auth-field textarea::placeholder {
    color: var(--auth-muted-soft);
}

.auth-field input:focus,
.auth-field textarea:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-focus-ring);
}

.auth-submit {
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    background: var(--auth-brand-bg);
    color: var(--auth-brand-text);
    font: inherit;
    font-weight: 750;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.auth-submit:hover:not(:disabled) {
    filter: brightness(1.08);
}

.auth-submit:focus-visible,
.auth-secondary:focus-visible,
.auth-switch a:focus-visible {
    outline: 3px solid var(--auth-focus-ring);
    outline-offset: 2px;
}

.auth-submit:disabled {
    cursor: wait;
    opacity: 0.65;
}

.auth-message {
    min-height: 20px;
    margin: -4px 0 0;
    color: var(--auth-danger);
    font-size: 13px;
    line-height: 1.45;
}

.auth-message:not(:empty) {
    padding: 10px 12px;
    border: 1px solid var(--auth-danger-border);
    border-radius: 10px;
    background: var(--auth-danger-bg);
}

.auth-message.is-error {
    color: var(--auth-danger);
    border-color: var(--auth-danger-border);
    background: var(--auth-danger-bg);
}

.auth-message.is-warning {
    color: var(--auth-warning);
    border-color: var(--auth-warning-border);
    background: var(--auth-warning-bg);
}

.auth-message.is-success {
    color: var(--auth-success);
    border-color: var(--auth-success-border);
    background: var(--auth-success-bg);
}

@media (max-width: 520px) {
    .auth-shell {
        padding: 16px;
    }

    .auth-card {
        padding: 28px 22px;
        border-radius: 14px;
    }
}

/* Membership registration */
.auth-page-wide .auth-shell {
    padding-block: 36px;
}

.auth-card-wide {
    width: min(100%, 820px);
}

.auth-section {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 20px;
    border: 1px solid var(--auth-border-soft);
    border-radius: 14px;
}

.auth-section legend {
    padding: 0 7px;
    color: var(--auth-text-strong);
    font-size: 15px;
    font-weight: 800;
}

.auth-legend-note {
    margin-left: 6px;
    color: var(--auth-muted-soft);
    font-size: 12px;
    font-weight: 500;
}

.auth-grid {
    display: grid;
    gap: 16px;
    align-items: start;
}

/*
 * Grid 열의 다른 필드에 help text가 있어도 입력 컨트롤이 세로로 늘어나지 않도록
 * 각 필드는 콘텐츠 높이 기준으로 정렬한다.
 */
.auth-grid > .auth-field {
    align-content: start;
}

.auth-field > input,
.auth-inline-control > input,
.auth-inline-control > button {
    height: 46px;
    min-height: 46px;
}

.auth-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-grid-address {
    grid-template-columns: 150px minmax(0, 1fr);
}

.auth-field em {
    margin-left: 3px;
    color: var(--auth-danger);
    font-size: 11px;
    font-style: normal;
}

.auth-field textarea {
    padding: 11px 13px;
    line-height: 1.5;
    resize: vertical;
}

.auth-inline-control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.auth-secondary {
    min-width: 92px;
    padding: 0 14px;
    border: 1px solid var(--auth-control-border);
    border-radius: 10px;
    background: var(--auth-surface);
    color: var(--auth-text-strong);
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.auth-secondary:hover:not(:disabled) {
    border-color: var(--auth-primary);
    background: var(--auth-selected-bg);
    color: var(--auth-link);
}

.auth-secondary:disabled {
    cursor: wait;
    opacity: 0.6;
}

.auth-help {
    min-height: 18px;
    color: var(--auth-muted-soft);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

.auth-help.is-success {
    color: var(--auth-success);
}

.auth-help.is-error {
    color: var(--auth-danger);
}

.auth-service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.auth-service-option {
    display: flex;
    gap: 10px;
    min-height: 94px;
    padding: 14px;
    border: 1px solid var(--auth-border);
    border-radius: 12px;
    background: var(--auth-surface-sub);
    color: var(--auth-text);
    cursor: pointer;
    transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.auth-service-option:hover {
    border-color: var(--auth-control-border);
}

.auth-service-option:has(input:checked) {
    border-color: var(--auth-primary);
    background: var(--auth-selected-bg);
    box-shadow: 0 0 0 2px var(--auth-focus-ring);
}

.auth-service-option input {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--auth-primary);
}

.auth-service-option span {
    display: grid;
    gap: 5px;
}

.auth-service-option strong {
    font-size: 14px;
}

.auth-service-option small {
    color: var(--auth-muted);
    font-size: 12px;
    line-height: 1.45;
}

.auth-details {
    border: 1px solid var(--auth-border-soft);
    border-radius: 14px;
    background: var(--auth-surface-sub);
}

.auth-details summary {
    padding: 16px 18px;
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
}

.auth-details summary span {
    margin-left: 6px;
    color: var(--auth-muted-soft);
    font-size: 12px;
    font-weight: 500;
}

.auth-details-body {
    display: grid;
    gap: 16px;
    padding: 4px 18px 18px;
}

.auth-agreements {
    display: grid;
    gap: 10px;
    padding: 16px 18px;
    border: 1px solid var(--auth-border-soft);
    border-radius: 12px;
    background: var(--auth-surface-muted);
}

.auth-agreements label {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--auth-text-strong);
    font-size: 13px;
    line-height: 1.45;
}

.auth-agreements input {
    margin-top: 2px;
    accent-color: var(--auth-primary);
}

.auth-agreements strong {
    color: var(--auth-danger);
    font-size: 11px;
}

.auth-switch {
    margin: 0;
    text-align: center;
    color: var(--auth-muted);
    font-size: 13px;
}

.auth-switch a {
    margin-left: 5px;
    color: var(--auth-link);
    font-weight: 750;
    text-decoration: none;
}

.auth-switch a:hover {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .auth-grid-2,
    .auth-grid-address,
    .auth-service-grid {
        grid-template-columns: 1fr;
    }

    .auth-card-wide {
        padding: 28px 22px;
    }
}

/* v0.4.0 - secure membership document upload */
.auth-file-field input[type="file"] {
    min-height: 50px;
    padding: 8px;
    border-color: var(--auth-input-border);
    background: var(--auth-surface);
    color: var(--auth-text);
}
.auth-file-field input[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 10px;
    padding: 6px 11px;
    border: 1px solid var(--auth-control-border);
    border-radius: 8px;
    background: var(--auth-surface-sub);
    color: var(--auth-text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.auth-file-field input[type="file"]::file-selector-button:hover {
    border-color: var(--auth-primary);
    background: var(--auth-selected-bg);
}
