/* ==========================================================================
   Maxim DevLab - Simple, Clean & Lightweight Stylesheet
   Natural personal portfolio styling — fast, readable, responsive.
   Supports automatic Light / Dark mode + manual theme toggle with smooth transitions.
   Accessibility: WCAG 2.1/2.2 AA & ADA compliant.
   Mobile-Optimized for all phone & tablet screen sizes.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --heading-color: #0f172a;
  --accent: #0284c7;
  --accent-hover: #0369a1;
  --btn-outline-bg: #ffffff;
  --btn-outline-hover: #f1f5f9;
  --radius: 8px;
  --max-width: 960px;
}

[data-theme="dark"] {
  --bg: #121417;
  --bg-subtle: #1a1d23;
  --bg-card: #181b20;
  --border: #2a303c;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --heading-color: #f8fafc;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --btn-outline-bg: #181b20;
  --btn-outline-hover: #222730;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417;
    --bg-subtle: #1a1d23;
    --bg-card: #181b20;
    --border: #2a303c;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --heading-color: #f8fafc;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --btn-outline-bg: #181b20;
    --btn-outline-hover: #222730;
  }
}

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

/* Smooth Theme Transitions */
body,
header,
footer,
.card,
.project-box,
.profile-sidebar,
.support-box,
.data-table th,
.data-table td,
.skill-badge,
.icon-btn,
.btn-outline,
.theme-toggle-btn,
.email-btn,
.project-preview {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

/* Accessibility: Respect Reduced Motion Preference */
@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;
  }
}

/* Accessibility: Visible Focus Indicators for Keyboard Users */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.6;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Nav */
header {
  border-bottom: 1px solid var(--border);
  background-color: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 0;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (min-width: 769px) {
  .nav-top-row {
    display: contents;
  }

  .brand {
    order: 1;
  }

  .nav-links {
    order: 2;
  }

  .nav-socials {
    order: 3;
  }
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading-color);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
  color: var(--accent);
}

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

.nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.nav-item-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
}

.nav-socials {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}

.icon-btn img {
  width: 16px;
  height: 16px;
}

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

/* Theme Toggle Button */
.theme-toggle-btn {
  font-size: 1rem;
  line-height: 1;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  transition: background-color 0.35s ease, border-color 0.35s ease, opacity 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--border);
}

/* Hero / Intro */
.intro-section {
  padding: 2.75rem 0 2rem;
  border-bottom: 1px solid var(--border);
}

.intro-content h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--heading-color);
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.intro-content p {
  font-size: 1.05rem;
  color: var(--text-main);
  max-width: 780px;
  margin-bottom: 1.2rem;
  line-height: 1.65;
}

.intro-subtext {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 780px;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
}

.btn-outline {
  background-color: var(--btn-outline-bg);
  color: var(--text-main);
  border-color: var(--border);
}

.btn-outline:hover {
  background-color: var(--btn-outline-hover);
}

.btn-coffee {
  background-color: #ffdd00;
  color: #000000;
  border-color: #eab308;
}

.btn-coffee:hover {
  background-color: #facc15;
}

.btn img {
  width: 16px;
  height: 16px;
}

/* Sections */
.section {
  padding: 2.5rem 0;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--heading-color);
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

/* Featured Project Box */
.project-box {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.project-box-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.project-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 2px;
  background-color: #ffffff;
}

.project-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--heading-color);
}

.project-desc {
  color: var(--text-main);
  font-size: 0.98rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

.project-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.75rem;
  align-items: center;
}

.project-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.project-preview img {
  border-radius: 6px;
  width: 100%;
  height: auto;
  display: block;
}

/* Feature List */
.feature-list {
  list-style: none;
  margin-bottom: 1.25rem;
}

.feature-list li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-main);
}

.feature-list li::before {
  content: "•";
  position: absolute;
  left: 0.25rem;
  color: var(--accent);
  font-weight: bold;
  font-size: 1.2rem;
  line-height: 1;
}

/* Cards Grid */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card {
  border: 1px solid var(--border);
  background-color: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--heading-color);
}

.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* About Page Styles */
.about-wrapper {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2.25rem;
  align-items: start;
  padding: 2rem 0;
}

.profile-sidebar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background-color: var(--bg-subtle);
  text-align: center;
}

/* Profile Avatar Container */
.profile-avatar-wrapper {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1rem;
  border: 2px solid var(--border);
  position: relative;
  background-color: var(--bg-subtle);
}

.profile-avatar-wrapper .profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border: none;
  margin: 0;
  border-radius: 0;
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading-color);
}

.profile-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Email Copy Button */
.email-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.55rem 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-main);
  cursor: pointer;
  position: relative;
  margin-top: 1rem;
  font-family: inherit;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.email-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--accent);
}

.email-btn .email-text {
  font-size: 0.8rem;
  user-select: text;
  -webkit-user-select: text;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.copied-toast {
  position: absolute;
  top: -24px;
  right: 50%;
  transform: translateX(50%) translateY(3px);
  background: #0f172a;
  color: #ffffff;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-weight: 600;
  white-space: nowrap;
}

[data-theme="dark"] .copied-toast {
  background: #f8fafc;
  color: #0f172a;
}

.copied-toast.show {
  opacity: 1;
  transform: translateX(50%) translateY(0);
}

.profile-links {
  list-style: none;
  text-align: left;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.profile-links a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-main);
  padding: 0.45rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.profile-links a:hover {
  text-decoration: none;
  background: var(--bg-subtle);
}

.profile-links img {
  width: 16px;
  height: 16px;
}

.about-body h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--heading-color);
  margin: 1.5rem 0 0.5rem;
}

.about-body h2:first-of-type {
  margin-top: 0;
}

.about-body p {
  margin-bottom: 1.15rem;
  font-size: 1rem;
  color: var(--text-main);
  line-height: 1.7;
}

/* Extension Page Specifics & Preview Modal */
.ext-header {
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ext-title-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.ext-title-area h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--heading-color);
}

.ext-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

.ext-header .btn-group {
  justify-content: center;
}

.ext-preview-box {
  margin: 1.5rem 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: zoom-in;
}

.ext-preview-img {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 580px;
  width: 100%;
  margin: 0 auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ext-preview-box:hover .ext-preview-img {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Lightbox Modal */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1.5rem;
}

.image-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  font-size: 1.75rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Specs Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 2rem;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  background-color: var(--bg-subtle);
  font-weight: 600;
  width: 30%;
  color: var(--heading-color);
}

.data-table td {
  color: var(--text-main);
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 1rem 0;
}

.breadcrumb a {
  color: var(--text-muted);
}

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

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  background-color: var(--bg-subtle);
  font-size: 0.88rem;
  color: var(--text-muted);
}

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

.footer-links {
  display: flex;
  gap: 1rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent);
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsiveness
   ========================================================================== */

@media (max-width: 768px) {
  .container {
    padding: 0 1rem;
  }

  /* Header & Navigation */
  .navbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.65rem 0;
  }

  .nav-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }

  .brand {
    font-size: 1.15rem;
  }

  .nav-socials {
    display: flex;
    align-items: center;
    gap: 0.35rem;
  }

  .icon-btn,
  .theme-toggle-btn {
    width: 30px;
    height: 30px;
  }

  .icon-btn img {
    width: 14px;
    height: 14px;
  }

  .nav-links {
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
    width: 100%;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin: 0;
  }

  .nav-links a {
    font-size: 0.88rem;
    white-space: nowrap;
    padding: 0.2rem 0.3rem;
  }

  /* Hero */
  .intro-section {
    padding: 1.5rem 0 1.25rem;
  }

  .intro-content h1 {
    font-size: 1.5rem;
  }

  .intro-content p {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
  }

  .intro-subtext {
    font-size: 0.9rem;
    margin-bottom: 0;
  }

  /* Projects */
  .section {
    padding: 1.5rem 0;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .project-box {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .project-box-header {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .project-icon {
    width: 40px;
    height: 40px;
  }

  .project-title {
    font-size: 1.2rem;
  }

  .project-desc {
    font-size: 0.92rem;
    margin-bottom: 1rem;
  }

  .feature-list {
    margin-bottom: 1rem;
  }

  .feature-list li {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  .project-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .project-preview {
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
  }

  .btn-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.5rem;
    margin-bottom: 1rem;
  }

  .btn-group .btn {
    width: 100%;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
  }

  /* About Me */
  .about-wrapper {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0.5rem 0 1.5rem;
  }

  .profile-sidebar {
    max-width: 100%;
    padding: 1.25rem 1rem;
  }

  .profile-img {
    width: 130px;
    height: 130px;
  }

  .profile-avatar-wrapper {
    width: 130px;
    height: 130px;
  }

  .about-body h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .about-body p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.9rem;
  }

  /* Extension Details Page & Compact Mobile Thumbnail */
  .ext-header {
    padding: 1rem 0;
  }

  .ext-title-area {
    gap: 0.75rem;
  }

  .ext-title-area h1 {
    font-size: 1.4rem;
  }

  .ext-subtitle {
    font-size: 0.92rem;
    margin-bottom: 1rem;
  }

  .ext-preview-box {
    margin: 0.75rem auto 1.25rem;
    max-width: 290px;
  }

  .grid-cards {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .card {
    padding: 1rem;
  }

  .card h3 {
    font-size: 1rem;
  }

  .card p {
    font-size: 0.88rem;
  }

  /* Responsive Stacked Table for Mobile */
  .data-table, 
  .data-table tbody, 
  .data-table tr, 
  .data-table th, 
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table {
    border: none;
    margin: 0.75rem 0 1.5rem;
  }

  .data-table tr {
    margin-bottom: 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
  }

  .data-table th {
    background-color: var(--bg-subtle);
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
    width: 100%;
    color: var(--heading-color);
  }

  .data-table td {
    border: none;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    background-color: var(--bg-card);
    word-break: break-word;
  }

  /* Footer */
  footer {
    padding: 1.25rem 0;
  }

  .footer-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }

  .footer-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.85rem;
    font-size: 0.85rem;
  }
}
