/* ============================================================
   ESSOW — style.css
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary:      #0f172a;
    --secondary:    #1e293b;
    --accent:       #fbbf24;
    --accent-light: #fcd34d;
    --text:         #f1f5f9;
    --text-dim:     #cbd5e1;
    --border:       #334155;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1a1f3a 50%, #0f172a 100%);
    /* Fix the background so it doesn't scroll — avoids the gradient repeating */
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── Page Layout ─────────────────────────────────────────── */

.main-wrapper {
    display: flex;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px;
    gap: 24px;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ─── Stars background ────────────────────────────────────── */

.stars {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star {
    position: absolute;
    width: 1px;
    height: 1px;
    background: white;
    border-radius: 50%;
    opacity: 0;
    animation: twinkle 3s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50%       { opacity: 1; }
}

/* ─── Main container ──────────────────────────────────────── */

.container {
    position: relative;
    z-index: 10;
    flex: 1;
    width: min(100%, 640px);
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    min-height: calc(100vh - 64px);
    min-height: calc(100dvh - 64px);
}

/* ─── Header ──────────────────────────────────────────────── */

.header {
    text-align: center;
    opacity: 0;
    animation: fadeInDown 0.8s ease-out forwards;
    width: 100%;
}

.header h1 {
    font-size: clamp(2.8rem, 8vw, 4.8rem);
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 0.95;
}

.header p {
    color: var(--text-dim);
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    letter-spacing: 0.5px;
    font-weight: 300;
}

/* ─── Input Section ───────────────────────────────────────── */

.input-section {
    width: 100%;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
    position: relative;
    z-index: 50;
    max-width: 720px;
}

.site-disclaimer,
.qa-disclaimer {
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
}

.site-disclaimer {
    margin-top: 14px;
    max-width: 54ch;
    margin-left: auto;
    margin-right: auto;
}

.site-links {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.site-links a {
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.site-links a:hover,
.site-links a:focus {
    color: var(--accent);
    opacity: 1;
}

.date-input-wrapper {
    position: relative;
}

/* Hidden native input — value is synced by JS */
.date-input-wrapper input[type="date"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.date-display {
    width: 100%;
    min-height: 74px;
    padding: 18px 24px;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    border-radius: 14px;
    color: var(--text);
    font-size: clamp(1.1rem, 2.2vw, 1.55rem);
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
    letter-spacing: 0.5px;
    font-family: inherit;
    user-select: none;
    display: flex;
    align-items: center;
}

.date-display:hover,
.date-display:focus {
    background: rgba(30, 41, 59, 0.7);
    border-color: var(--accent);
    outline: none;
}

.date-display.active {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.2);
}

/* ─── Calendar ────────────────────────────────────────────── */
/* Appended to <body> by JS — position:fixed relative to viewport */

.calendar-picker {
    position: fixed;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    z-index: 999999;
    display: none;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    width: min(300px, calc(100vw - 16px));
}

.calendar-picker.active {
    display: block;
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.year-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.year-selector button {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--accent);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    transition: background 0.2s;
}

.year-selector button:hover {
    background: rgba(251, 191, 36, 0.25);
}

.year-selector span {
    color: var(--text);
    font-weight: 500;
    font-size: 0.85rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-header h3 {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 0.5px;
}

.calendar-nav {
    width: 28px;
    height: 28px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}

.calendar-nav:hover {
    background: rgba(251, 191, 36, 0.22);
    border-color: var(--accent);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.weekday {
    text-align: center;
    font-size: 0.68rem;
    color: var(--text-dim);
    font-weight: 500;
    padding: 4px 0;
    letter-spacing: 0.3px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.day-btn {
    aspect-ratio: 1;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.72rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.day-btn:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.day-btn.selected {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: var(--primary);
    font-weight: 600;
    border-color: var(--accent);
}

.day-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

/* ─── Submit Button ───────────────────────────────────────── */

.submit-btn {
    width: 100%;
    min-height: 74px;
    padding: 16px 26px;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border: none;
    border-radius: 16px;
    color: var(--primary);
    font-weight: 700;
    font-size: clamp(1.1rem, 2.3vw, 1.55rem);
    letter-spacing: 0.6px;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s, box-shadow 0.25s;
}

.submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s;
}

.submit-btn:hover::before  { background: rgba(255, 255, 255, 0.15); }
.submit-btn:hover          { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(251, 191, 36, 0.35); }
.submit-btn:active         { transform: translateY(0); }
.submit-btn:disabled       { opacity: 0.5; cursor: not-allowed; }

.btn-text    { display: inline; }
.btn-loading { display: none; }
.submit-btn.loading .btn-text    { display: none; }
.submit-btn.loading .btn-loading { display: inline; }

/* ─── Result Container ────────────────────────────────────── */

.result-container {
    width: 100%;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: clamp(20px, 5vw, 40px);
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.result-container.active {
    display: flex;
    animation: slideUp 0.6s ease-out;
}

.sign-icon {
    font-size: clamp(3rem, 12vw, 5rem);
    line-height: 1;
    animation: float 3s ease-in-out infinite;
}

.sign-name {
    font-size: clamp(1.5rem, 5vw, 2rem);
    font-weight: 300;
    letter-spacing: 1px;
    color: var(--accent);
}

.date-range {
    color: var(--text-dim);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    letter-spacing: 0.5px;
}

.description {
    text-align: center;
    line-height: 1.65;
    color: var(--text-dim);
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    opacity: 0;
    animation: fadeIn 0.8s ease-out 0.3s forwards;
    width: 100%;
}

.traits {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.trait {
    padding: 10px 12px;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 6px;
    font-size: clamp(0.75rem, 2vw, 0.85rem);
    text-align: center;
    color: var(--accent-light);
    opacity: 0;
    animation: slideInTrait 0.6s ease-out forwards;
}

.trait:nth-child(1) { animation-delay: 0.4s; }
.trait:nth-child(2) { animation-delay: 0.5s; }
.trait:nth-child(3) { animation-delay: 0.6s; }
.trait:nth-child(4) { animation-delay: 0.7s; }

/* ─── Q&A / Chat ──────────────────────────────────────────── */

.qa-section {
    width: 100%;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: clamp(16px, 4vw, 24px);
    display: none;
    flex-direction: column;
    gap: 14px;
}

.qa-section.active {
    display: flex;
    animation: slideUp 0.6s ease-out;
}

.qa-header { text-align: center; margin-bottom: 4px; }

.qa-header h3 {
    font-size: clamp(1rem, 3vw, 1.2rem);
    color: var(--accent);
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.qa-header p {
    color: var(--text-dim);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
}

.qa-disclaimer {
    margin-top: 4px;
}

.chat-container {
    min-height: 200px;
    max-height: 320px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Smooth scroll for new messages */
    scroll-behavior: smooth;
}

.chat-container::-webkit-scrollbar { width: 5px; }
.chat-container::-webkit-scrollbar-track { background: transparent; }
.chat-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.chat-container::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.message {
    display: flex;
    gap: 8px;
    word-break: break-word;
    font-size: clamp(0.8rem, 2vw, 0.88rem);
    animation: fadeIn 0.3s ease-out;
}

.message.user  { justify-content: flex-end; }

.message-content {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 6px;
    line-height: 1.45;
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: var(--primary);
    font-weight: 500;
}

.message.ai .message-content {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: var(--text-dim);
}

.message-icon {
    font-size: 0.9rem;
    align-self: flex-end;
    padding-bottom: 2px;
    flex-shrink: 0;
}

.typing-indicator {
    display: flex;
    gap: 5px;
    align-items: center;
    padding: 8px 12px;
}

.typing-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.qa-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.qa-input {
    flex: 1;
    padding: 10px 12px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    font-family: inherit;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.qa-input::placeholder { color: var(--text-dim); opacity: 0.7; }

.qa-input:focus {
    outline: none;
    background: rgba(30, 41, 59, 0.85);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.12);
}

.qa-submit {
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border: none;
    border-radius: 6px;
    color: var(--primary);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
}

.qa-submit:hover    { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(251, 191, 36, 0.3); }
.qa-submit:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ─── Reset Button ────────────────────────────────────────── */

.reset-btn {
    margin-top: 12px;
    padding: 10px 26px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    font-family: inherit;
    transition: border-color 0.25s, color 0.25s;
}

.reset-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Static Pages ────────────────────────────────────────── */

.info-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.info-shell {
    position: relative;
    z-index: 10;
    width: min(100%, 760px);
    background: rgba(30, 41, 59, 0.46);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: clamp(24px, 5vw, 44px);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.info-header {
    text-align: center;
    margin-bottom: 28px;
}

.info-kicker {
    display: inline-block;
    margin-bottom: 12px;
    color: var(--accent-light);
    font-size: 0.84rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.info-header h1 {
    font-size: clamp(2rem, 6vw, 3.4rem);
    font-weight: 300;
    letter-spacing: 1px;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.info-header p {
    color: var(--text-dim);
    font-size: clamp(0.98rem, 2.6vw, 1.1rem);
    line-height: 1.7;
    max-width: 56ch;
    margin: 0 auto;
}

.info-content {
    display: grid;
    gap: 18px;
}

.info-card {
    background: rgba(15, 23, 42, 0.58);
    border: 1px solid rgba(251, 191, 36, 0.12);
    border-radius: 16px;
    padding: 18px 18px 20px;
}

.info-card h2 {
    color: var(--accent-light);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: 0.4px;
}

.info-card p,
.info-card li {
    color: var(--text-dim);
    line-height: 1.75;
    font-size: 0.96rem;
}

.info-card ul {
    padding-left: 18px;
    display: grid;
    gap: 8px;
}

.info-card a {
    color: var(--accent-light);
}

.info-footer {
    margin-top: 26px;
    display: flex;
    justify-content: center;
}

.back-home {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 999px;
    text-decoration: none;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* ─── Keyframes ───────────────────────────────────────────── */

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-18px); }
}

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

@keyframes typing {
    0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
    30%            { opacity: 1;   transform: translateY(-5px); }
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 600px) {
    .main-wrapper          { padding: 20px 16px; }
    .container             { min-height: calc(100dvh - 40px); gap: 24px; }
    .header h1             { font-size: clamp(2.6rem, 16vw, 4rem); }
    .header p              { font-size: clamp(0.95rem, 4.8vw, 1.3rem); }
    .date-display          { min-height: 68px; padding: 16px 18px; border-radius: 14px; }
    .submit-btn            { min-height: 70px; border-radius: 16px; }
    .chat-container        { min-height: 180px; max-height: 260px; }
    .message-content       { max-width: 100%; }
    .traits                { grid-template-columns: 1fr; }
    .result-container      { padding: 28px 18px; }
}

@media (max-width: 480px) {
    .main-wrapper          { padding: 16px 12px; }
    .container             { gap: 20px; }
    .header h1             { letter-spacing: 1px; }
    .site-disclaimer,
    .qa-disclaimer         { font-size: 0.76rem; }
    .site-links            { gap: 8px 14px; }
    .site-links a          { font-size: 0.84rem; }
    .calendar-picker       { padding: 14px 10px; }
    .qa-input-group        { flex-direction: column; }
    .qa-submit             { width: 100%; min-height: 48px; }
    .reset-btn             { width: 100%; }
    .info-page             { padding: 20px 12px; }
    .info-shell            { border-radius: 18px; }
    .info-card             { padding: 16px; }
}

@media (min-width: 1200px) {
    .container             { max-width: 680px; }
    .chat-container        { max-height: 360px; }
}
