/* ============================================================================
   ISLES OF TIME -- BASE STYLES
   style-base.css
   Color system, typography, geometry, base element rules.
   Adapted from AtlOS style-base.css.
   No layout. No component-specific rules. Foundation only.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   FONT IMPORTS
   ---------------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Rajdhani:wght@400;500;600;700&display=swap');

/* ----------------------------------------------------------------------------
   CSS CUSTOM PROPERTIES -- COLOR SYSTEM
   ---------------------------------------------------------------------------- */

:root {
  /* Backgrounds */
  --bg-primary:     #0a0c0f;   /* main background */
  --bg-secondary:   #080a0d;   /* nav panel, sidebar */
  --bg-tertiary:    #0d1117;   /* header bars, document header */
  --bg-overlay:     #060810;   /* boot screen, modal backdrops */

  /* Borders */
  --border-primary:  #1e2530;  /* main structural borders */
  --border-secondary:#141820;  /* subtle dividers */
  --border-accent:   #243040;  /* major section breaks */
  --border-highlight:#2a4a63;  /* hover, focus states */

  /* Accent blues */
  --accent:         #5a9fc5;   /* primary accent -- filing codes, headings */
  --accent-dim:     #3a5a7a;   /* hover states, secondary accent */
  --accent-dark:    #2a4a63;   /* mandate borders, subtle accents */
  --accent-bright:  #7abfe0;   /* active states, selected items */

  /* Text */
  --text-primary:   #e0eaf4;   /* document titles, important content */
  --text-secondary: #9aaabb;   /* body text */
  --text-dim:       #8a9aaa;   /* nav items, secondary content */
  --text-muted:     #5d7a94;   /* labels, metadata, nav codes */
  --text-ghost:     #3a4d5e;   /* inactive items, placeholders */

  /* Status colors */
  --status-verified:   #3a8a65; /* green -- verified */
  --status-source:     #5a9fc5; /* blue -- source tier */
  --status-warn:       #9a7a2a; /* amber -- disputed, flagged */
  --status-restricted: #8a2a2a; /* red -- classified and above */
  --status-unverified: #4d5f70; /* grey -- unverified */

  /* Duplicate / alert colors */
  --alert-duplicate:   #7a3a1e; /* filing code conflict */
  --alert-altered:     #5a4a1e; /* altered copy detected */

  /* Typography scale */
  --font-mono:    'Share Tech Mono', 'Courier New', monospace;
  --font-ui:      'Rajdhani', 'Arial Narrow', sans-serif;

  --text-xs:      11px;   /* labels, metadata fields */
  --text-sm:      12px;   /* nav codes, secondary labels */
  --text-base:    13px;   /* body text */
  --text-md:      14px;   /* comfortable body reading */
  --text-lg:      17px;   /* section titles */
  --text-xl:      20px;   /* document titles */
  --text-2xl:     24px;   /* major headings */

  --tracking-wide:   0.10em;
  --tracking-wider:  0.15em;
  --tracking-widest: 0.20em;

  /* Geometry */
  --cut-sm:   10px;
  --cut-md:   14px;
  --cut-lg:   18px;
  --cut-xl:   24px;

  /* Clip paths -- diagonal cut top-right corner */
  --clip-sm:  polygon(0 0, calc(100% - var(--cut-sm))  0, 100% var(--cut-sm),  100% 100%, 0 100%);
  --clip-md:  polygon(0 0, calc(100% - var(--cut-md))  0, 100% var(--cut-md),  100% 100%, 0 100%);
  --clip-lg:  polygon(0 0, calc(100% - var(--cut-lg))  0, 100% var(--cut-lg),  100% 100%, 0 100%);
  --clip-xl:  polygon(0 0, calc(100% - var(--cut-xl))  0, 100% var(--cut-xl),  100% 100%, 0 100%);

  /* Clip path -- double cut (top-right + bottom-left) for featured elements */
  --clip-double-sm: polygon(0 var(--cut-sm), var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%);
  --clip-double-md: polygon(0 var(--cut-md), var(--cut-md) 0, 100% 0, 100% calc(100% - var(--cut-md)), calc(100% - var(--cut-md)) 100%, 0 100%);

  /* Spacing */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   12px;
  --space-lg:   16px;
  --space-xl:   24px;
  --space-2xl:  32px;

  /* Transitions -- functional only */
  --transition-fast:   80ms ease;
  --transition-base:   150ms ease;
}

/* ----------------------------------------------------------------------------
   RESET AND BASE
   ---------------------------------------------------------------------------- */

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

html, body {
  height: 100%;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Allow text selection inside document content areas */
.selectable {
  user-select: text;
  cursor: text;
}

/* ----------------------------------------------------------------------------
   SCROLLBARS -- match the aesthetic
   ---------------------------------------------------------------------------- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-accent);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}

/* ----------------------------------------------------------------------------
   TYPOGRAPHY -- BASE ELEMENTS
   ---------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  line-height: 1.2;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl);  }
h3 { font-size: var(--text-lg);  }
h4 { font-size: var(--text-md);  color: var(--accent); }
h5 { font-size: var(--text-base); color: var(--text-dim); }
h6 { font-size: var(--text-sm);   color: var(--text-muted); }

p {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-sm);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-bright);
}

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* ----------------------------------------------------------------------------
   UTILITY CLASSES -- TEXT
   ---------------------------------------------------------------------------- */

.text-primary   { color: var(--text-primary);   }
.text-secondary { color: var(--text-secondary);  }
.text-dim       { color: var(--text-dim);        }
.text-muted     { color: var(--text-muted);      }
.text-ghost     { color: var(--text-ghost);      }
.text-accent    { color: var(--accent);          }

.text-xs        { font-size: var(--text-xs);     }
.text-sm        { font-size: var(--text-sm);     }
.text-base      { font-size: var(--text-base);   }
.text-md        { font-size: var(--text-md);     }
.text-lg        { font-size: var(--text-lg);     }
.text-xl        { font-size: var(--text-xl);     }

.font-mono      { font-family: var(--font-mono); }
.font-ui        { font-family: var(--font-ui);   }

.uppercase      { text-transform: uppercase;     }
.tracking-wide  { letter-spacing: var(--tracking-wide);   }
.tracking-wider { letter-spacing: var(--tracking-wider);  }
.tracking-widest{ letter-spacing: var(--tracking-widest); }

/* ----------------------------------------------------------------------------
   UTILITY CLASSES -- GEOMETRY
   ---------------------------------------------------------------------------- */

.clip-sm     { clip-path: var(--clip-sm);        }
.clip-md     { clip-path: var(--clip-md);        }
.clip-lg     { clip-path: var(--clip-lg);        }
.clip-xl     { clip-path: var(--clip-xl);        }
.clip-double { clip-path: var(--clip-double-md); }

/* ----------------------------------------------------------------------------
   STRUCTURAL BORDERS
   ---------------------------------------------------------------------------- */

.border           { border: 1px solid var(--border-primary);   }
.border-secondary { border: 1px solid var(--border-secondary); }
.border-accent    { border: 1px solid var(--border-accent);    }
.border-highlight { border: 1px solid var(--border-highlight); }
.border-left-accent { border-left: 2px solid var(--accent-dark); }

/* ----------------------------------------------------------------------------
   LABEL STYLE -- used for section headers, field keys, status indicators
   ---------------------------------------------------------------------------- */

.label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-muted);
}

.label-accent {
  color: var(--accent);
}

/* ----------------------------------------------------------------------------
   STATUS INDICATORS -- verification state dots
   ---------------------------------------------------------------------------- */

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.verified    { background-color: var(--status-verified);   }
.status-dot.source      { background-color: var(--status-source);     }
.status-dot.unverified  { background-color: var(--status-unverified); }
.status-dot.disputed    { background-color: var(--status-warn);       }
.status-dot.flagged     { background-color: var(--status-warn);       }
.status-dot.restricted  { background-color: var(--status-restricted); }

/* ----------------------------------------------------------------------------
   DIVIDERS
   ---------------------------------------------------------------------------- */

.divider {
  border: none;
  border-top: 1px solid var(--border-secondary);
  margin: var(--space-md) 0;
}

.divider-major {
  border: none;
  border-top: 1px solid var(--border-accent);
  margin: var(--space-xl) 0;
}

/* ----------------------------------------------------------------------------
   INTERACTIVE ELEMENTS -- buttons
   ---------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 9px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-accent);
  border-left: 2px solid var(--border-highlight);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition-fast),
              border-color var(--transition-fast),
              background var(--transition-fast);
}

.btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-dim);
  border-left-color: var(--accent);
  background: rgba(90, 159, 197, 0.07);
}

.btn:active {
  background: rgba(90, 159, 197, 0.13);
  border-left-color: var(--accent-bright);
}

.btn-primary {
  clip-path: var(--clip-double-md);
  border-color: var(--accent-dim);
  border-left: 2px solid var(--accent);
  color: var(--accent);
  background: rgba(90, 159, 197, 0.06);
  padding: 9px 24px;
}

.btn-primary:hover {
  border-color: var(--accent);
  border-left-color: var(--accent-bright);
  color: var(--text-primary);
  background: rgba(90, 159, 197, 0.13);
}

/* ----------------------------------------------------------------------------
   ALERTS
   ---------------------------------------------------------------------------- */

.alert {
  padding: var(--space-sm) var(--space-md);
  border-left: 2px solid var(--alert-duplicate);
  background: rgba(122, 58, 30, 0.08);
  font-size: var(--text-sm);
  color: var(--text-dim);
}

.alert-altered {
  border-left-color: var(--alert-altered);
  background: rgba(90, 74, 30, 0.08);
}

/* ----------------------------------------------------------------------------
   ANIMATIONS -- functional only
   ---------------------------------------------------------------------------- */

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

@keyframes crt-boot {
  0%   { transform: scaleY(1);    opacity: 1;   }
  20%  { transform: scaleY(0.02); opacity: 0.8; }
  40%  { transform: scaleY(1.04); opacity: 1;   }
  60%  { transform: scaleY(0.98); opacity: 1;   }
  100% { transform: scaleY(1);    opacity: 1;   }
}

@keyframes crt-resolve {
  0%   { filter: hue-rotate(20deg) brightness(1.4); }
  100% { filter: hue-rotate(0deg)  brightness(1);   }
}

@keyframes flicker {
  0%   { opacity: 1;    }
  92%  { opacity: 1;    }
  93%  { opacity: 0.4;  }
  94%  { opacity: 1;    }
  96%  { opacity: 0.7;  }
  97%  { opacity: 1;    }
  100% { opacity: 1;    }
}

.stagger-reveal {
  opacity: 0;
  animation: fadeInUp 0.3s ease forwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}

/* ----------------------------------------------------------------------------
   FOCUS -- keyboard navigation
   ---------------------------------------------------------------------------- */

:focus-visible {
  outline: 1px solid var(--accent-dim);
  outline-offset: 2px;
}
