/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.75;
  color: var(--text-body);
  background-color: var(--bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

ul, ol {
  list-style: none;
}

/* --- Variables (Design Tokens) --- */
:root {
  /* Palette */
  --color-dark-bg: #21163C;
  --color-paper-bg: #F4F3F7;
  --color-text-body: #191523;
  --color-brand-blue: #5214EB;
  --color-accent-red: #ED926E;

  /* Derived / Semantic Tokens */
  --bg-dark: var(--color-dark-bg);
  --bg-paper: var(--color-paper-bg);
  --text-body: var(--color-text-body);
  --text-paper: var(--color-paper-bg); /* Text on dark bg */
  --brand-color: var(--color-brand-blue);
  --accent-color: var(--color-accent-red);

  /* Layout & Spacing */
  --radius-card: 20px;
  --radius-btn: 12px;
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --section-y: clamp(5rem, 10vw, 9rem);
  --content-max: 1120px;
  
  /* Shadows */
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.15);
  --card-hover-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.22);
  --border-subtle: 1px solid rgba(25, 21, 35, 0.08);

  /* Typography Scale */
  --font-h1: clamp(2rem, 4.6vw, 3.4rem);
  --font-h2: clamp(1.6rem, 3vw, 2.4rem);
  --font-h3: 1.25rem;
  --font-body: 1rem;
}

/* --- Layout Containers --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section-wrapper {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.dark-section {
  background-color: var(--bg-dark);
  color: var(--text-paper);
}

.light-section {
  background-color: var(--bg-paper);
  color: var(--text-body);
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(244, 243, 247, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.05);
  padding: 16px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-body);
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.main-nav ul {
  display: flex;
  gap: 24px;
}

.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-body);
}

.main-nav a:hover, .main-nav a[aria-current="page"] {
  color: var(--brand-color);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: var(--accent-color);
  color: var(--bg-dark);
  font-weight: 700;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 48px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(237, 146, 110, 0.3);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--brand-color);
  outline-offset: 2px;
}

/* --- Typography Components --- */
.breadcrumb-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* Paper context */
.light-section .breadcrumb-label { color: var(--brand-color); }
/* Dark context */
.dark-section .breadcrumb-label { color: var(--accent-color); }

.heading-title {
  font-size: var(--font-h2);
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 24px;
  letter-spacing: 0;
}

.highlight-text {
  /* Default to brand for light sections */
  color: var(--brand-color); 
}

.dark-section .highlight-text {
  color: var(--accent-color);
}

p {
  margin-bottom: 1.5em;
  max-width: 38em;
}

/* --- Grid & Cards --- */
.grid-layout {
  display: grid;
  gap: var(--gap);
}

.card-panel {
  background-color: var(--bg-paper);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 32px;
  border: var(--border-subtle);
  transition: box-shadow 0.3s ease;
}

.dark-section .card-panel {
  /* Light cards inside dark sections revert to paper colors */
  background-color: var(--bg-paper);
  color: var(--text-body);
}

.card-panel:hover {
  box-shadow: var(--card-hover-shadow);
}

/* --- Buttons in Content --- */
.content-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  border: 1px solid currentColor;
  background: transparent;
  transition: all 0.2s ease;
}

.light-section .btn-secondary {
  color: var(--text-body);
  border-color: var(--text-body);
}

.dark-section .btn-secondary {
  color: var(--text-paper);
  border-color: var(--text-paper);
}

.btn-secondary:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

/* --- Tables --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
}

.data-table th, .data-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.data-table th {
  font-weight: 700;
  color: var(--text-body);
  background-color: rgba(25, 21, 35, 0.03);
}

.dark-section .data-table th {
  background-color: rgba(244, 243, 247, 0.1);
  color: var(--text-paper);
}

/* --- FAQ (Details/Summary) --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-item {
  background-color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(25, 21, 35, 0.08);
  border-radius: 12px;
  overflow: hidden;
}

.faq-item summary {
  padding: 20px;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--brand-color);
}

.faq-item[open] summary::after {
  content: '−';
}

.faq-item p {
  padding: 0 20px 20px;
  margin: 0;
  color: var(--text-body);
  font-size: 0.95rem;
}

/* --- Timeline (Day Workflow) --- */
.timeline {
  position: relative;
  padding-left: 32px;
  border-left: 2px solid rgba(25, 21, 35, 0.1);
}

.timeline-item {
  position: relative;
  margin-bottom: 48px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-time {
  position: absolute;
  left: -32px;
  top: 0;
  width: 64px;
  text-align: right;
  font-weight: 700;
  color: var(--brand-color);
  font-size: 0.9rem;
}

.timeline-dot {
  position: absolute;
  left: -39px;
  top: 4px;
  width: 16px;
  height: 16px;
  background-color: var(--bg-paper);
  border: 3px solid var(--brand-color);
  border-radius: 50%;
  z-index: 2;
}

.dark-section .timeline-dot {
  background-color: var(--bg-dark);
  border-color: var(--accent-color);
}

.dark-section .timeline-time {
  color: var(--accent-color);
}

.dark-section .timeline {
  border-left-color: rgba(244, 243, 247, 0.2);
}

/* --- News Cards --- */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.news-card {
  background-color: var(--bg-paper);
  border-radius: var(--radius-card);
  padding: 24px;
  border: 1px solid rgba(25, 21, 35, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.news-date {
  font-size: 0.8rem;
  color: var(--brand-color);
  margin-bottom: 12px;
  font-weight: 600;
}

.dark-section .news-date {
  color: var(--accent-color);
}

.news-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

.news-excerpt {
  font-size: 0.95rem;
  color: var(--text-body);
  opacity: 0.8;
}

/* --- Footer --- */
.site-footer {
  background-color: var(--bg-dark);
  color: var(--text-paper);
  padding: 64px 0 32px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
  margin-bottom: 48px;
}

.footer-col h4 {
  color: var(--text-paper);
  margin-bottom: 20px;
  font-size: 1rem;
}

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col a {
  color: rgba(244, 243, 247, 0.7);
  font-size: 0.9rem;
}

.footer-col a:hover {
  color: var(--accent-color);
}

.footer-bottom {
  border-top: 1px solid rgba(244, 243, 247, 0.1);
  padding-top: 32px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(244, 243, 247, 0.5);
}

/* --- Responsive Tweaks --- */
@media (max-width: 768px) {
  :root {
    --font-h1: 2rem;
    --section-y: clamp(4rem, 12vw, 6rem);
  }
  
  .header-inner nav {
    display: none; /* Simple hide for mobile, ideally hamburger */
  }
  
  .grid-layout-2-col {
    grid-template-columns: 1fr !important;
  }
  
  .content-split {
    flex-direction: column-reverse;
  }
}

/* --- SVG Animations --- */
/* Keyframes */
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes float-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes dash-flow {
  to { stroke-dashoffset: -24; }
}

/* Classes */
.svg-draw {
  path, rect, circle, line {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: draw-line 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  }
}

.float-element {
  animation: float-slow 6s ease-in-out infinite;
}

.pulse-dot {
  animation: pulse-opacity 3s ease-in-out infinite;
}

.flow-line {
  stroke-dasharray: 12 12;
  animation: dash-flow 1s linear infinite;
}

.reduced-motion * {
  animation: none !important;
  transition-duration: 0s !important;
}

/* Prefers 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;
  }
}
