/* ==========================================================================
   ~/kp Portfolio Design System & Stylesheet
   Typography: JetBrains Mono
   Theme: Minimalist / Terminal-inspired (Dark default with Light switch)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens & Theme Variables
   -------------------------------------------------------------------------- */
:root {
  /* Dark Theme (Default) — deep obsidian-violet */
  --bg-primary: #130f1a;
  --bg-surface: #1a1524;
  --bg-surface-elevated: #231d30;
  --bg-header: rgba(19, 15, 26, 0.85);
  
  --text-primary: #f2eef8;
  --text-secondary: #a69bb8;
  --text-muted: #6e6480;
  --text-hover-accent: #c4b5fd; /* Complementary soft luminous lavender */
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-accent: rgba(255, 255, 255, 0.35);

  --accent-base: #f2eef8;
  --accent-glow: rgba(242, 238, 248, 0.15);
  --accent-cyan: #a78bfa;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;

  /* Custom Scrollbar Colors (Dark) */
  --scrollbar-track: #130f1a;
  --scrollbar-thumb: rgba(166, 155, 184, 0.28);
  --scrollbar-thumb-hover: rgba(196, 181, 253, 0.55);

  /* Container & Rhythm — narrower content, larger side blank spaces */
  --max-width: 620px;
  --header-height: 64px;
  --transition-fast: 0.18s ease;
  --transition-smooth: 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-spring: 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Light Theme Overrides — very light blue */
[data-theme="light"] {
  --bg-primary: #f5f7f7;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #e9eeef;
  --bg-header: rgba(245, 247, 247, 0.88);

  --text-primary: #141b24;
  --text-secondary: #4a5568;
  --text-muted: #828f9d;
  --text-hover-accent: #5b21b6; /* Complementary deep rich violet */

  --border-color: rgba(0, 0, 0, 0.07);
  --border-hover: rgba(0, 0, 0, 0.16);
  --border-accent: rgba(0, 0, 0, 0.35);

  --accent-base: #141b24;
  --accent-glow: rgba(0, 0, 0, 0.1);
  --accent-cyan: #0284c7;
  --accent-emerald: #059669;
  --accent-amber: #d97706;

  /* Custom Scrollbar Colors (Light) */
  --scrollbar-track: #f5f7f7;
  --scrollbar-thumb: rgba(74, 85, 104, 0.28);
  --scrollbar-thumb-hover: rgba(91, 33, 182, 0.55);
}

/* --------------------------------------------------------------------------
   2. Reset & Base Typography
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-y: scroll; /* Reserves scrollbar width to prevent side space shifts between pages */
  scrollbar-gutter: stable; /* Standard modern CSS to lock consistent page widths */
  scrollbar-width: thin; /* Firefox modern scrollbar */
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-feature-settings: "liga" 1, "calt" 1, "zero" 1;
  font-size: 15px;
  line-height: 1.65;
  scroll-behavior: auto; /* Snappy, instant scroll transitions without lag */
  scroll-padding-top: calc(var(--header-height) + 24px);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Instant theme transitions: no transition delay on html */
}

/* --------------------------------------------------------------------------
   Custom Sleek Minimalist Scrollbar (WebKit / Chrome / Safari / Edge)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

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

::-webkit-scrollbar-corner {
  background: transparent;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  overflow-x: hidden;
}

::selection {
  background: var(--text-primary);
  color: var(--bg-primary);
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   3. Site Header & Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  padding-top: 2.2rem; /* Sits slightly lower in the page, adding space between top of window and header */
  padding-bottom: 0.75rem;
  background-color: var(--bg-header);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: none; /* No separating line between header and body */
  /* Instant theme transitions: no transition delay on header */
}

.header-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Top Left Brand: Directly aligned with the body text below */
.header-left {
  display: flex;
  align-items: center;
}

/* --------------------------------------------------------------------------
   ~/kp Brand Link (No Box Hover)
   -------------------------------------------------------------------------- */
.brand-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  background: transparent;
}

.brand-link:hover {
  background: transparent; /* No box hover effect */
}

/* ~/kp is slightly larger and bolder than section navigation text */
.brand-text {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

/* When hovering over kp in top left, the color of the text itself changes */
.brand-link:hover .brand-text,
.brand-link:hover .brand-core {
  color: var(--text-hover-accent);
  transition: color var(--transition-fast);
}

/* --------------------------------------------------------------------------
   5. Header Right: Navigation Links + Theme Switcher
   -------------------------------------------------------------------------- */
.header-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  font-size: 0.97rem;
  font-weight: 400;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0;
  background: transparent;
  position: relative;
  text-decoration: none;
}

/* No box hover: changes text color directly on hover */
.nav-link:hover {
  color: var(--text-hover-accent);
  background: transparent;
  transition: color var(--transition-fast);
}

/* Underline the text of the page that the user is currently on */
.nav-link.current-page {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1.5px;
  text-decoration-color: var(--text-hover-accent);
}

.nav-link.current-page:hover {
  color: var(--text-hover-accent);
}

/* --------------------------------------------------------------------------
   6. Theme Switcher Button (Sun / Moon) — Filled In, Instant Switch, No Box
   -------------------------------------------------------------------------- */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: none; /* Removed the box around the theme icon */
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
}

.theme-toggle-btn:hover {
  background: transparent;
  border: none;
  color: var(--text-hover-accent);
  transition: color var(--transition-fast);
}

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

.theme-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  pointer-events: none;
}

/* Instant Theme Icon Visibility — Zero Lag, Simultaneous Repaint */
[data-theme="dark"] .sun-icon {
  display: block;
}

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

[data-theme="light"] .sun-icon {
  display: none;
}

[data-theme="light"] .moon-icon {
  display: block;
}

/* --------------------------------------------------------------------------
   7. Main Layout & Narrow Container (Wide Side Margins)
   -------------------------------------------------------------------------- */
.site-main {
  flex: 1;
  padding: 1.5rem 0 4.5rem; /* Reduced space between header and body */
}

.content-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --------------------------------------------------------------------------
   8. Home Page Intro
   -------------------------------------------------------------------------- */
.page-intro {
  display: flex;
  flex-direction: column;
}

.intro-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 2.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

.terminal-tag {
  color: var(--text-muted);
  opacity: 0.8;
}

.page-title {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 1.5rem;
}

.greeting {
  color: var(--text-secondary);
  font-weight: 400;
}

.name {
  color: var(--text-primary);
}

.lead-bio {
  font-size: 1.05rem;
  color: var(--text-primary);
  line-height: 1.75;
  margin-bottom: 1.25rem;
}

.body-bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 2.75rem;
}

.quick-nav-block {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1.75rem;
}

.quick-nav-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quick-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.94rem;
  color: var(--text-secondary);
}

.quick-link:hover {
  color: var(--text-hover-accent);
  transform: translateX(4px);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.arrow {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.quick-link:hover .arrow {
  color: var(--text-hover-accent);
  transition: color var(--transition-fast);
}

/* --------------------------------------------------------------------------
   9. Page Content Typography (About, Projects, Writing)
   -------------------------------------------------------------------------- */
.page-content {
  display: flex;
  flex-direction: column;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-heading {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.prose-intro {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 2.25rem;
}

.prose {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  font-size: 0.96rem;
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.prose-small {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.sub-section {
  margin-top: 1.5rem;
}

.sub-section + .sub-section {
  margin-top: 2.25rem;
}

.sub-heading {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.inline-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.inline-link:hover {
  color: var(--text-hover-accent);
  transition: color var(--transition-fast);
}

/* --------------------------------------------------------------------------
   10. Experience Section (About Page)
   -------------------------------------------------------------------------- */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.experience-item {
  display: flex;
  flex-direction: column;
}

.experience-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.experience-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.experience-company-line {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.experience-company-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-primary);
  text-decoration: none;
}

.experience-company-link:hover .experience-company {
  color: var(--text-hover-accent);
  transition: color var(--transition-fast);
}

.company-logo {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  display: inline-block;
}

.shopify-logo {
  color: #96bf48; /* Classic Shopify Lime Green */
}

[data-theme="light"] .shopify-logo {
  color: #008060; /* Shopify Dark Emerald for light mode */
}

.firefox-logo {
  color: #ff7139; /* Classic Firefox Flame Orange */
}

[data-theme="light"] .firefox-logo {
  color: #d94a14; /* High-contrast deep orange for light mode */
}

.experience-company {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.experience-role {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.experience-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.highlight {
  color: var(--text-primary);
  font-weight: 500;
}

.experience-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding-left: 0;
}

.experience-bullets li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.90rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.experience-bullets li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.experience-desc {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.experience-desc p {
  font-size: 0.90rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

@media (max-width: 540px) {
  .experience-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
}

/* --------------------------------------------------------------------------
   10b. Technical Skills Section (About Page)
   -------------------------------------------------------------------------- */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.skill-label {
  color: var(--text-primary);
  font-weight: 500;
  margin-right: 0.35rem;
}

.skill-items {
  color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   10c. Minimalist Bullet List (About Page)
   -------------------------------------------------------------------------- */
.bullet-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-left: 0;
}

.bullet-list li {
  position: relative;
  padding-left: 1.25rem;
  font-size: 0.90rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.bullet-list li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   11. Project Items (Projects Page)
   -------------------------------------------------------------------------- */
.project-items {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.project-entry {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px dashed var(--border-color);
}

.project-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.project-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.project-name {
  font-size: 1.08rem;
  font-weight: 600;
}

.entry-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-primary);
}

.entry-link:hover {
  color: var(--text-hover-accent);
  transition: color var(--transition-fast);
}

.entry-link:hover .arrow {
  color: var(--text-hover-accent);
  transform: translate(2px, -2px);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.project-summary {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

.tag {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.tag:hover {
  color: var(--text-secondary);
}

.tag:not(:last-child)::after {
  content: "·";
  margin: 0 0.45rem;
  color: var(--text-muted);
  opacity: 0.6;
}

.badge {
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active {
  background-color: rgba(167, 139, 250, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.badge-shipped {
  background-color: rgba(52, 211, 153, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-wip {
  background-color: rgba(251, 191, 36, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

/* --------------------------------------------------------------------------
   12. Articles List (Writing Page) — Matches Project Items Spacing
   -------------------------------------------------------------------------- */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.article-entry {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px dashed var(--border-color);
}

.article-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.article-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.article-title {
  font-size: 1.08rem;
  font-weight: 600;
}

.article-link {
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.article-link:hover {
  color: var(--text-hover-accent);
  transition: color var(--transition-fast);
}

.article-link:hover .arrow {
  color: var(--text-hover-accent);
  transform: translate(2px, -2px);
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.article-summary {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.article-footer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.2rem;
}

.article-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.article-meta {
  font-size: 0.74rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   12b. Post Detail View (Writing Page)
   -------------------------------------------------------------------------- */
.post-back-nav {
  margin-bottom: 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast), transform var(--transition-fast);
}

.back-link:hover {
  color: var(--text-hover-accent);
  transform: translateX(-3px);
}

.post-header {
  margin-bottom: 2rem;
}

.post-header .page-heading {
  margin-bottom: 0.75rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.wip-note {
  font-style: italic;
  color: var(--text-muted);
  padding: 1rem 0 1rem 1rem;
  border-left: 2px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   13. Site Footer
   -------------------------------------------------------------------------- */
.site-footer {
  width: 100%;
  margin-top: auto;
  border-top: 1px dashed var(--border-color);
  padding: 2rem 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-brand {
  color: var(--text-secondary);
  font-weight: 500;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.footer-link {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-hover-accent);
}

.footer-icon {
  width: 16px;
  height: 16px;
  display: block;
}

/* --------------------------------------------------------------------------
   14. Responsive Layout Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 600px) {
  :root {
    --header-height: 58px;
  }

  .site-header {
    padding-top: 1.5rem;
  }

  .header-left {
    margin-left: 0;
  }

  .header-container {
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .content-container {
    padding: 0 1rem;
  }

  .nav-list {
    gap: 0.85rem;
  }

  .nav-link {
    font-size: 0.88rem;
  }

  .page-title {
    font-size: 1.75rem;
  }

  .spec-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .spec-term {
    width: auto;
  }

  .article-entry {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }

  .article-meta {
    display: none;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}
