/* ==========================================================================
   Design Tokens & Modern Color Schemes
   ========================================================================== */

:root {
  /* Color Scheme declaration for native browser widgets & scrollbars */
  color-scheme: light dark;

  /* Typography Stacks */
  --font-serif: 'Newsreader', Georgia, Cambria, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Default / Light Mode Palette (Warm Editorial High-Contrast) */
  --bg-primary: #fcfbf9;
  --text-primary: #121316;
  --text-secondary: #5a5e6b;
  --border-subtle: #e2e4e9;
  --link-hover: #000000;
  --toggle-bg: #f3f4f6;
  --toggle-hover-bg: #e5e7eb;
  --toggle-border: #dcdfe5;
  --focus-ring: #1a56db;

  /* Layout Constants */
  --site-max-width: 820px;
  --content-spacing: clamp(1.5rem, 4vw, 3rem);
}

/* Explicit Dark Mode Overrides */
[data-theme="dark"] {
  --bg-primary: #0d0e12;
  --text-primary: #f4f5f7;
  --text-secondary: #9aa1b0;
  --border-subtle: #242833;
  --link-hover: #ffffff;
  --toggle-bg: #181b22;
  --toggle-hover-bg: #222630;
  --toggle-border: #2c3240;
  --focus-ring: #60a5fa;
}

/* Automatic System Dark Mode fallback if no explicit attribute is set */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0d0e12;
    --text-primary: #f4f5f7;
    --text-secondary: #9aa1b0;
    --border-subtle: #242833;
    --link-hover: #ffffff;
    --toggle-bg: #181b22;
    --toggle-hover-bg: #222630;
    --toggle-border: #2c3240;
    --focus-ring: #60a5fa;
  }
}

/* ==========================================================================
   CSS Reset & Base Element Styles
   ========================================================================== */

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

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

/* ==========================================================================
   Layout Structure
   ========================================================================== */

.site-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  max-width: var(--site-max-width);
  margin-inline: auto;
  padding: var(--content-spacing);
}

/* Header & Theme Switcher */
.site-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding-bottom: 2rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.theme-toggle:hover {
  background-color: var(--toggle-hover-bg);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.96);
}

/* Icon visibility depending on current theme */
.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

[data-theme="dark"] .sun-icon {
  display: block;
}

[data-theme="dark"] .moon-icon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sun-icon {
    display: block;
  }
  :root:not([data-theme="light"]) .moon-icon {
    display: none;
  }
}

/* ==========================================================================
   Main Hero Section: Name, Tagline, Links
   ========================================================================== */

.site-main {
  flex: 1;
  display: flex;
  align-items: center;
  padding-block: clamp(2rem, 8vh, 6rem);
}

.hero-content {
  width: 100%;
  max-width: 680px;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(2.75rem, 7vw, 4.75rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--text-primary);
  margin-bottom: clamp(1rem, 2.5vw, 1.5rem);
}

.hero-tagline {
  font-family: var(--font-sans);
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: clamp(2rem, 4vw, 2.75rem);
  max-width: 48ch;
}

.separator {
  display: inline-block;
  margin-inline: 0.35rem;
  opacity: 0.55;
}

/* Links Navigation */
.links-list {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
  flex-wrap: wrap;
}

.profile-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.profile-link:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

.arrow-icon {
  color: var(--text-secondary);
  transition: transform 0.2s ease, color 0.2s ease;
}

.profile-link:hover .arrow-icon {
  color: var(--link-hover);
  transform: translate(2px, -2px);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  width: 100%;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.copyright {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ==========================================================================
   Motion Preference Support (WCAG 2.2 AA)
   ========================================================================== */

@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;
  }

  .theme-toggle:hover,
  .profile-link:hover .arrow-icon {
    transform: none !important;
  }
}
