/* =========================================
   SafeW Global Styles & Design System
   ========================================= */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.65;
    color: var(--color-text-main);
    background-color: var(--color-bg-paper);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --- Color Tokens & Variables --- */
:root {
    /* 基础色板 */
    --color-bg-dark: #1B1231;
    --color-bg-paper: #F4F3F7;
    --color-text-main: #191523;
    --color-brand: #5214EB;
    --color-accent: #9977EE;

    /* 结构变量 */
    --content-max: 1120px;
    --section-y: clamp(3.5rem, 7vw, 6rem);
    --gap: clamp(1rem, 2vw, 1.75rem);
    
    /* 组件样式 */
    --radius-card: 24px;
    --radius-btn: 999px;
    --card-border: 2px solid var(--color-text-main);
    --card-shadow: 4px 4px 0 var(--color-text-main);
    --header-height: 72px;
}

/* --- Layout Utilities --- */
.container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

.section {
    padding: var(--section-y) 0;
    position: relative;
}

.section--dark {
    background-color: var(--color-bg-dark);
    color: var(--color-bg-paper);
}

.section--paper {
    background-color: var(--color-bg-paper);
    color: var(--color-text-main);
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    margin-bottom: 1rem;
    text-wrap: balance;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: 1.5rem;
    text-wrap: balance;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    text-wrap: balance;
}

p {
    margin-bottom: 1rem;
    max-width: 38em;
}

.text-hl {
    color: var(--color-brand);
    font-weight: 800;
}

.section--dark .text-hl {
    color: var(--color-accent);
}

/* --- Components: Badge & Lead --- */
.badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    color: var(--color-brand);
}

.section--dark .badge {
    color: var(--color-accent);
}

.hero-lead {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    margin-bottom: 2rem;
    opacity: 0.9;
    max-width: 45em;
}

/* --- Components: Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--radius-btn);
    transition: transform 0.2s ease, filter 0.2s ease;
    cursor: pointer;
    border: none;
    min-height: 48px;
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

.btn--primary {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
}

.btn--outline {
    background-color: transparent;
    color: var(--color-text-main);
    border: 2px solid var(--color-text-main);
}

.section--dark .btn--outline {
    color: var(--color-bg-paper);
    border-color: var(--color-bg-paper);
}

/* --- Components: Cards --- */
.card {
    background-color: var(--color-bg-paper);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.section--dark .card {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 4px 4px 0 rgba(255, 255, 255, 0.1);
    color: var(--color-bg-paper);
}

.card__icon {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Grid Systems */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--gap);
}

/* --- Components: Tables --- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-card);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--color-bg-paper);
    color: var(--color-text-main);
    min-width: 500px;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

th {
    font-weight: 700;
    background-color: rgba(0,0,0,0.03);
}

tr:last-child td {
    border-bottom: none;
}

/* --- Components: FAQ (Details/Summary) --- */
details {
    border: var(--card-border);
    border-radius: var(--radius-card);
    margin-bottom: 0.75rem;
    background-color: var(--color-bg-paper);
    overflow: hidden;
    transition: all 0.2s ease;
}

details[open] {
    box-shadow: var(--card-shadow);
}

summary {
    padding: 1rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0,0,0,0.02);
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    font-size: 1.25rem;
    font-weight: 400;
}

details[open] summary::after {
    content: "-";
}

details p {
    padding: 1rem 1.5rem;
    margin-bottom: 0;
    font-size: 0.95rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

/* --- Components: Header & Footer --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--color-bg-paper);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    font-weight: 800;
    font-size: 1.25rem;
}

.logo img {
    width: 32px;
    height: auto;
}
.site-footer img {
    width: 24px;
    height: auto;
}

.nav-list {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    padding: 0.5rem 0;
    position: relative;
}

.nav-link:hover, .nav-link[aria-current="page"] {
    color: var(--color-brand);
}

.nav-link[aria-current="page"]::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-brand);
}

@media (max-width: 768px) {
    .nav-list { display: none; } /* Simplified mobile nav for this task */
}

.site-footer {
    background-color: var(--color-bg-dark);
    color: var(--color-bg-paper);
    padding: 3rem 0;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    list-style: none;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--color-bg-paper);
    text-decoration: none;
    opacity: 0.8;
}

.footer-links a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* --- SVG Animation Classes --- */
@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-reverse-slow {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes float-up {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes dash-flow {
    to { stroke-dashoffset: -100; }
}

.anim-rotate {
    animation: rotate-slow 20s linear infinite;
    transform-box: fill-box;
    transform-origin: center;
}

.anim-rotate-rev {
    animation: rotate-reverse-slow 25s linear infinite;
    transform-box: fill-box;
    transform-origin: center;
}

.anim-float {
    animation: float-up 6s ease-in-out infinite;
}

.anim-dash {
    stroke-dasharray: 10;
    animation: dash-flow 2s linear infinite;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
/* factory-contrast-width */
@media (max-width: 390px) {
  [data-fc-390="paper"] {
    color: #f4f3f7 !important;
    -webkit-text-fill-color: #f4f3f7 !important;
  }
}
@media (min-width: 391px) {
  [data-fc-390="paper"] {
    color: #191523 !important;
    -webkit-text-fill-color: #191523 !important;
  }
}
