/* ============================================
   FONT FACES
============================================ */
@font-face {
  font-family: 'Lora';
  src: url('fonts/Lora/Lora-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Lora';
  src: url('fonts/Lora/Lora-Italic-VariableFont_wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito Sans';
  src: url('fonts/Nunito_Sans/NunitoSans-VariableFont_YTLC,opsz,wdth,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito Sans';
  src: url('fonts/Nunito_Sans/NunitoSans-Italic-VariableFont_YTLC,opsz,wdth,wght.ttf') format('truetype');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('fonts/Courier_Prime/CourierPrime-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('fonts/Courier_Prime/CourierPrime-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('fonts/Courier_Prime/CourierPrime-Italic.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ============================================
   DESIGN TOKENS
============================================ */
:root {
  /* Brand colors */
  --c-purple:  #821cff;
  --c-pink:    #ff25a8;
  --c-yellow:  #ffe017;
  --c-blue:    #00a5dc;
  --c-teal:    #00d7bb;

  /* Gradients */
  --g-1:       linear-gradient(135deg, #821cff 0%, #ff25a8 100%);
  --g-2:       linear-gradient(135deg, #00a5dc 0%, #00d7bb 100%);
  --g-3:       linear-gradient(135deg, #ff25a8 0%, #ffe017 100%);
  --g-4:       linear-gradient(135deg, #821cff 0%, #00a5dc 100%);
  --g-rainbow: linear-gradient(135deg, #821cff 0%, #ff25a8 30%, #ffe017 60%, #00d7bb 100%);
  --g-holo:    linear-gradient(135deg, #821cff 0%, #ff25a8 25%, #ffe017 50%, #00a5dc 75%, #00d7bb 100%);

  /* Animation */
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   THEME — LIGHT
============================================ */
[data-theme="light"] {
  --bg:              #f7f5f2;
  --bg-alt:          #eeeae4;
  --surface:         #ffffff;
  --surface-raised:  #fdfcfb;
  --text:            #1a1618;
  --text-2:          #4a4550;
  --text-3:          #8a8490;
  --border:          #dedad4;
  --border-focus:    var(--c-purple);

  --photo-shadow:
    0 1px 2px rgba(0,0,0,.06),
    0 4px 8px  rgba(0,0,0,.10),
    0 12px 24px rgba(0,0,0,.14),
    0 24px 48px rgba(0,0,0,.10);

  --win-shadow:
    0 1px 3px rgba(0,0,0,.06),
    0 4px 12px rgba(0,0,0,.08),
    0 12px 32px rgba(0,0,0,.06);

  --overlay-bg: rgba(247, 245, 242, 0.97);
  --scrollbar:  #ccc8c2;
}

/* ============================================
   THEME — DARK
============================================ */
[data-theme="dark"] {
  --bg:              #0e0d10;
  --bg-alt:          #151318;
  --surface:         #1c1920;
  --surface-raised:  #211e26;
  --text:            #f0ecf8;
  --text-2:          #a09ab0;
  --text-3:          #5a5565;
  --border:          #2e2a38;
  --border-focus:    var(--c-purple);

  --photo-shadow:
    0 1px 2px rgba(0,0,0,.4),
    0 4px 8px  rgba(0,0,0,.5),
    0 12px 24px rgba(0,0,0,.6),
    0 24px 48px rgba(0,0,0,.4);

  --win-shadow:
    0 1px 3px rgba(0,0,0,.3),
    0 4px 12px rgba(0,0,0,.4),
    0 12px 32px rgba(0,0,0,.3);

  --overlay-bg: rgba(14, 13, 16, 0.97);
  --scrollbar:  #3a3545;
}

/* ============================================
   RESET & BASE
============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  font-size: 15px;
  line-height: 1.65;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Theme transition — only fires on toggle click */
body.theme-changing,
body.theme-changing * {
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease !important;
}

img { max-width: 100%; display: block; }
a   { color: inherit; }
ul, ol { list-style: none; }

/* Screen-reader only */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* Shared focus ring */
:focus-visible {
  outline: 2px solid var(--c-purple);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: rgba(130, 28, 255, 0.18);
  color: var(--text);
}

/* ============================================
   SKIP NAV
============================================ */
.skip-nav {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 9999;
  padding: 10px 20px;
  background: var(--c-purple);
  color: #fff;
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 4px 16px rgba(130,28,255,.4);
  transition: top 0.2s ease;
}
.skip-nav:focus { top: 0; }

/* ============================================
   PAGE BACKGROUND TEXTURE
============================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 60% 50% at 15% 20%, rgba(130, 28, 255, 0.045) 0%, transparent 100%),
    radial-gradient(ellipse 50% 60% at 85% 75%, rgba(0, 215, 187, 0.04) 0%, transparent 100%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(255, 37, 168, 0.025) 0%, transparent 100%);
}

/* Subtle dot grid */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.5;
}

/* ============================================
   SITE HEADER
============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Rainbow shimmer line under header */
.site-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--g-holo);
  background-size: 300% 100%;
  animation: holo-shimmer 6s linear infinite;
}

@keyframes holo-shimmer {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* Logo */
.site-logo {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 1px;
}

.site-logo .logo-accent {
  background: var(--g-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Nav controls */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background-color 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover { background: var(--bg-alt); }

.icon-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Theme toggle icon visibility */
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Hamburger lines */
.ham-lines {
  display: flex;
  flex-direction: column;
  gap: 4.5px;
  width: 20px;
}
.ham-lines span {
  display: block;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.28s var(--ease-out-back), opacity 0.2s ease;
  transform-origin: center;
}
.ham-lines span:nth-child(1) { width: 20px; }
.ham-lines span:nth-child(2) { width: 14px; }
.ham-lines span:nth-child(3) { width: 20px; }

[aria-expanded="true"] .ham-lines span:nth-child(1) { transform: translateY(6px) rotate(45deg); width: 20px; }
[aria-expanded="true"] .ham-lines span:nth-child(2) { opacity: 0; transform: scaleX(0); }
[aria-expanded="true"] .ham-lines span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); width: 20px; }

/* ============================================
   FULL-PAGE NAV OVERLAY
============================================ */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--overlay-bg);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.nav-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 40% at 20% 30%, rgba(130,28,255,.07) 0%, transparent 100%),
    radial-gradient(ellipse 50% 40% at 80% 70%, rgba(0,215,187,.07) 0%, transparent 100%);
  pointer-events: none;
}

.nav-overlay[aria-hidden="false"] {
  opacity: 1;
  pointer-events: all;
}

.nav-overlay-close {
  position: absolute;
  top: 14px;
  right: 16px;
}

.overlay-nav ul {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.overlay-nav a {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 800;
  font-size: clamp(2.8rem, 9vw, 6rem);
  text-decoration: none;
  color: var(--text);
  position: relative;
  line-height: 1;
  transition: color 0.18s ease;
  display: inline-block;
}

.overlay-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 0;
  height: 3px;
  background: var(--g-1);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.overlay-nav a:hover { color: var(--c-purple); }
.overlay-nav a:hover::after { width: 100%; }
.overlay-nav a:focus-visible::after { width: 100%; }

/* Decorative number beside nav links */
.overlay-nav a .nav-num {
  font-size: 0.5em;
  font-weight: 500;
  color: var(--text-3);
  vertical-align: super;
  margin-right: 4px;
  font-family: 'Courier Prime', monospace;
}

/* ============================================
   BROWSER WINDOW WIDGET BASE
============================================ */

/* Per-widget gradient border color */
.browser-win {
  --win-border-gradient: var(--g-1);
}
.widget-status     { --win-border-gradient: var(--g-4); }
.widget-listening  { --win-border-gradient: var(--g-3); }
.widget-coloring   { --win-border-gradient: var(--g-rainbow); }
.widget-bio        { --win-border-gradient: var(--g-1); }
.widget-studying   { --win-border-gradient: var(--g-1); }
.widget-want-study { --win-border-gradient: var(--g-2); }
.widget-projects   { --win-border-gradient: var(--g-3); }
.widget-substack   { --win-border-gradient: var(--g-4); }
.widget-guestbook  { --win-border-gradient: var(--g-rainbow); }
.widget-updates    { --win-border-gradient: var(--g-2); }

.browser-win {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    var(--win-border-gradient) border-box;
  border: 2px solid transparent;
  border-radius: 11px;
  box-shadow: var(--win-shadow);
  overflow: hidden;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Window chrome / title bar */
.win-chrome {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 8px 10px;
}

/* Muted tinted chrome backgrounds */
.win-chrome.grad-1       { background: linear-gradient(135deg, rgba(130,28,255,0.13) 0%, rgba(255,37,168,0.13) 100%); }
.win-chrome.grad-2       { background: linear-gradient(135deg, rgba(0,165,220,0.13) 0%, rgba(0,215,187,0.13) 100%); }
.win-chrome.grad-3       { background: linear-gradient(135deg, rgba(255,37,168,0.13) 0%, rgba(255,224,23,0.13) 100%); }
.win-chrome.grad-4       { background: linear-gradient(135deg, rgba(130,28,255,0.13) 0%, rgba(0,165,220,0.13) 100%); }
.win-chrome.grad-rainbow { background: linear-gradient(135deg, rgba(130,28,255,0.10) 0%, rgba(255,37,168,0.10) 30%, rgba(255,224,23,0.10) 65%, rgba(0,215,187,0.10) 100%); }

.win-close {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.5rem;
  color: var(--text-2);
  opacity: 0.45;
  flex-shrink: 0;
  cursor: default;
  order: 2;
  margin-left: auto;
  line-height: 1;
  user-select: none;
}

.win-titlebar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  order: 1;
}

.win-title {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--win-border-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Widget content area */
.win-body {
  padding: 14px 15px 16px;
}

/* ============================================
   WIDGET TYPOGRAPHY & COMMON COMPONENTS
============================================ */

/* Inline decorative icon */
.w-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.75;
}

/* Status badge */
.tag {
  display: inline-block;
  font-family: 'Courier Prime', monospace;
  font-size: 0.69rem;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--c-purple);
  margin-top: 6px;
  margin-right: 4px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Pulse dot */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22cc5a;
  margin-right: 7px;
  flex-shrink: 0;
  animation: pulse-live 2.5s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(34, 204, 90, 0.5);
}

@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 204, 90, 0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(34, 204, 90, 0); }
}

/* Body text */
.w-body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text);
}

/* Section mini-heading inside widget */
.w-subhead {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================
   BUTTON
============================================ */
.btn {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: var(--g-1);
  color: #fff;
  align-self: flex-end;
  transition: opacity 0.15s ease, transform 0.12s ease;
  box-shadow: 0 2px 8px rgba(130,28,255,.3);
}

.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); opacity: 1; }

/* ============================================
   DECORATIVE ELEMENTS
============================================ */
.deco {
  pointer-events: none;
  user-select: none;
  flex-shrink: 0;
}

.scatter-deco {
  position: absolute;
  pointer-events: none;
  user-select: none;
  opacity: 0.18;
  z-index: 0;
}

[data-theme="dark"] .scatter-deco { opacity: 0.12; }

/* ============================================
   FOOTER
============================================ */
.site-footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  font-family: 'Courier Prime', monospace;
  font-size: 0.8rem;
  color: var(--text-3);
  transition: border-color 0.3s ease;
}

.site-footer a {
  color: var(--c-purple);
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

/* ============================================
   RESPONSIVE
============================================ */
@media (max-width: 600px) {
  .overlay-nav a { font-size: clamp(2.2rem, 12vw, 3.5rem); }
}

/* ============================================
   HIGH CONTRAST / REDUCED MOTION
============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
