/**
 * TITAN Custom CSS
 * Editorial visual system aligned with /tmp/landing.
 */

:root {
    --rust-50: #fef7f0;
    --rust-100: #fdecd8;
    --rust-200: #fad5b0;
    --rust-300: #f6b67d;
    --rust-400: #f19048;
    --rust-500: #ed7424;
    --rust-600: #c4480a;
    --rust-700: #a5390a;
    --rust-800: #842f10;
    --rust-900: #6b2910;
    --paper: #fafaf8;
    --ink: #1a1a1a;
    --paper-card: #ffffff;
    --border-ink: rgba(26, 26, 26, 0.1);
    --border-ink-strong: rgba(26, 26, 26, 0.18);
    --text-muted: rgba(26, 26, 26, 0.58);
    --text-faint: rgba(26, 26, 26, 0.34);
    --shadow-soft: rgba(26, 26, 26, 0.06);
    --select-bg: #ffffff;
    --select-optgroup-bg: #fafaf8;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    max-width: 100vw;
    background: var(--paper);
    color: var(--ink);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

::selection {
    background-color: rgba(196, 72, 10, 0.15);
    color: var(--ink);
}

h1,
h2,
h3,
.font-display {
    font-family: 'Playfair Display', Georgia, serif;
}

.font-mono {
    font-family: 'IBM Plex Mono', Consolas, monospace;
}

.page-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-color: var(--paper);
    background-image:
        linear-gradient(rgba(26, 26, 26, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(26, 26, 26, 0.018) 1px, transparent 1px);
    background-size: 80px 80px;
    animation: none;
}

/* ============================================
   Application shell: landing editorial treatment
   ============================================ */
main > header,
main > .sticky {
    background: rgba(250, 250, 248, 0.96) !important;
    border-bottom: 1px solid rgba(26, 26, 26, 0.10) !important;
    box-shadow: none !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

main > header h1,
main > .sticky h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0;
}

main > header p,
main > .sticky p {
    font-family: 'IBM Plex Mono', Consolas, monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(26, 26, 26, 0.42) !important;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
    background-color: rgba(26, 26, 26, 0.035) !important;
    border-color: rgba(26, 26, 26, 0.12) !important;
    color: var(--ink) !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(196, 72, 10, 0.55) !important;
    box-shadow: 0 0 0 1px rgba(196, 72, 10, 0.16) !important;
}

.bg-blue-50,
.bg-blue-50\/50,
.bg-blue-500\/10 {
    background-color: rgba(26, 26, 26, 0.04) !important;
}

.text-blue-500,
.text-blue-600,
.text-blue-700 {
    color: rgba(26, 26, 26, 0.72) !important;
}

.border-blue-200 {
    border-color: rgba(26, 26, 26, 0.12) !important;
}

.rule-editorial {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--ink) 20%, var(--ink) 80%, transparent);
    opacity: 0.15;
}

.pull-quote {
    position: relative;
    padding-left: 2rem;
}

.pull-quote::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--rust-600);
}

.num-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
    font-family: 'IBM Plex Mono', Consolas, monospace;
    font-size: 0.875rem;
    font-weight: 600;
}

.rounded-xl,
.rounded-2xl,
.rounded-3xl {
    border-radius: 0.5rem !important;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.running {
    background: #0f766e;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
    animation: pulse 2s infinite;
}

.status-dot.warning {
    background: var(--rust-500);
    animation: pulse 1s infinite;
}

.status-dot.error {
    background: #b91c1c;
}

.status-dot.offline {
    background: rgba(26, 26, 26, 0.2);
}

.toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(26, 26, 26, 0.12);
    border-radius: 26px;
    transition: 0.3s;
}

.toggle .slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 4px rgba(26, 26, 26, 0.18);
}

.toggle input:checked + .slider {
    background: var(--rust-600);
}

.toggle input:checked + .slider::before {
    transform: translateX(22px);
}

.quota-bar {
    height: 8px;
    background: rgba(26, 26, 26, 0.08);
    border-radius: 4px;
    overflow: hidden;
}

.quota-progress {
    height: 100%;
    background: var(--rust-600);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.quota-bar.warning .quota-progress {
    background: #b91c1c;
}

.plan-card-featured {
    border-color: var(--rust-600);
    box-shadow: 0 18px 60px rgba(196, 72, 10, 0.12);
}

.credit-option input {
    position: absolute;
    opacity: 0;
}

.credit-option-content,
.instance-type-option {
    transition: all 0.2s ease;
}

.credit-option input:checked + .credit-option-content,
.instance-type-option.selected {
    border-color: var(--rust-600);
    background: rgba(196, 72, 10, 0.08);
}

.instance-type-option {
    cursor: pointer;
}

.instance-type-option:hover {
    border-color: rgba(196, 72, 10, 0.35);
    background: rgba(196, 72, 10, 0.05);
}

.modal-overlay {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay .modal-content {
    transform: scale(0.98) translateY(16px);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.reveal,
.reveal-left,
.reveal-right {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.reveal-left {
    transform: translateX(-32px);
}

.reveal-right {
    transform: translateX(32px);
}

.reveal.revealed,
.reveal-left.revealed,
.reveal-right.revealed {
    opacity: 1;
    transform: translate(0, 0);
}

.stagger > * {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.stagger.revealed > *:nth-child(1) { transition-delay: 0s; opacity: 1; transform: translateY(0); }
.stagger.revealed > *:nth-child(2) { transition-delay: 0.1s; opacity: 1; transform: translateY(0); }
.stagger.revealed > *:nth-child(3) { transition-delay: 0.2s; opacity: 1; transform: translateY(0); }
.stagger.revealed > *:nth-child(4) { transition-delay: 0.3s; opacity: 1; transform: translateY(0); }
.stagger.revealed > *:nth-child(5) { transition-delay: 0.4s; opacity: 1; transform: translateY(0); }
.stagger.revealed > *:nth-child(6) { transition-delay: 0.5s; opacity: 1; transform: translateY(0); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.animate-pulse { animation: pulse 2s infinite; }
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-marquee { animation: marquee 30s linear infinite; }
.cursor-blink { animation: blink 1s step-end infinite; }

body.impersonating .sidebar ~ main {
    padding-top: 36px;
}

body.impersonating .sidebar ~ main .sticky.top-0 {
    top: 36px;
}

@media (max-width: 767px) {
    #impersonation-banner {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        gap: 0.5rem;
    }
}

@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
    }
}

@media (min-width: 1024px) {
    .sidebar {
        transform: none;
        visibility: visible;
    }
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.34);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 25;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 767px) {
    .mobile-p {
        padding: 1rem !important;
    }

    .mobile-table th,
    .mobile-table td {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8125rem;
    }

    .mobile-no-border-l {
        border-left: none !important;
        border-top: 1px solid var(--border-ink) !important;
        padding-top: 1rem;
    }
}

.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23c4480a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

select:focus {
    outline: none;
}

select option {
    background-color: var(--select-bg);
    color: var(--ink);
    padding: 12px 16px;
}

select option:hover,
select option:focus,
select option:checked {
    background-color: rgba(196, 72, 10, 0.12);
}

select option:disabled {
    color: var(--text-faint);
}

select optgroup {
    background-color: var(--select-optgroup-bg);
    color: var(--rust-600);
    font-weight: 600;
}

@-moz-document url-prefix() {
    select {
        scrollbar-color: var(--rust-600) var(--paper);
    }

    select option {
        padding: 8px 12px;
    }
}
