/* public/css/style.css */

/* ===================================================================
   BASE & MOBILE-FIRST STYLES (Default: Small Screens)
   =================================================================== */

/* --- 1. Variables and Global Styles (Theme Setup) --- */

/* Base variables for light mode */

:root {
  /* Brand */
  --color-primary: #2f8f9d;

  /* Light theme */
  --color-bg: #f4f4f5;
  --color-surface: #ffffff;

  --color-text-main: #1e1e1e;
  --color-text-soft: #6c757d;

  --color-border: #dddddd;

  --shadow-subtle: 0 2px 6px rgba(0, 0, 0, 0.04);

  /* Design system */
  --spacing-unit: 1.5rem;
  --radius-main: 14px;

  --font-stack: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  --content-max-width: 720px;
}

/* Apply base styles */
body {
  font-family: var(--font-stack);
  margin: 0;
  padding: 0;
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

/* Global Content Wrapper for compact design */
section,
footer {
  /* Centering content and applying max-width */
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--spacing-unit);
}

section {
  padding-top: 4rem;
  padding-bottom: 4rem;
  scroll-margin-top: 90px; /* fixes anchor jump */
}

h1,
h2,
h3 {
  color: var(--color-text-main);
  line-height: 1.2;
  margin-bottom: 0.75rem;
}
h2 {
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: clamp(1.8rem, 4vw, 2.3rem);
  letter-spacing: -0.5px;
}

h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin-top: 8px;
  background: var(--color-primary);
  border-radius: 999px;
}

p,
li,
label {
  color: var(--color-text-main);
}

small,
.contact-note,
footer p {
  color: var(--color-text-soft);
}

strong {
  color: var(--color-primary);
  font-weight: 600;
}

/* --- 2. Header and Navigation --- */

#header {
  /* Sticking the header to the top for easy access to navigation/toggle */
  position: sticky;
  top: 0;
  z-index: 1000;

  background-color: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.03);

  padding: 0.9rem var(--spacing-unit);
  border-radius: 0 0 var(--radius-main) var(--radius-main);

  /* Layout: Logo (Left) - Menu (Center) - Toggle (Right) */
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* flex-wrap: wrap; */

  /* Apply compact constraint only to inner header content */
  max-width: var(--content-max-width);
  margin: 0 auto;
}

.header__logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-primary);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.header__logo:hover {
  opacity: 0.8;
}

.header__menu ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; /* Horizontal alignment */
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.header__menu a {
  text-decoration: none;
  color: var(--color-text-main);
  font-weight: 500;
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  position: relative;
  padding: 6px 4px;
  transition: color 0.25s ease;
}

.header__menu a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.25s ease;
}

.header__menu a:hover {
  color: var(--color-primary);
}

.header__menu a:hover::after {
  width: 100%;
}

/* Active nav link */
.header__menu a.active {
  color: var(--color-primary);
  font-weight: 600;
}

/* Active underline */
.header__menu a.active::after {
  width: 100%;
}

#theme-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--color-text-main);
  line-height: 1;
}

#theme-toggle:hover {
  opacity: 0.7;
}

/* --- 3. Hero Section --- */

#hero-section {
  text-align: center;
  padding-top: 3rem;
  padding-bottom: var(--spacing-unit);
  min-height: calc(100svh - 80px);
}

#hero-section img {
  width: clamp(150px, 30vw, 200px);
  height: clamp(150px, 30vw, 200px);
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: var(--spacing-unit);
  border: 4px solid var(--color-primary);
  transition: transform 0.25s ease;
  background-color: var(--color-surface);
  box-shadow: 0 25px 50px
    color-mix(in srgb, var(--color-primary) 15%, transparent);
}

#hero-section img:hover {
  transform: scale(1.03);
}

.hero__intro {
  font-size: 1.15rem;
  color: var(--color-text-soft);
  max-width: 520px;
}

#hero-section h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.15;
  font-weight: 700;
}

.hero-content {
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  justify-content: center; /* Mobile center */
}

.hero-btn {
  text-decoration: none;
  padding: 0.7rem 1.2rem;
  border-radius: calc(var(--radius-main) / 1.5);
  font-weight: 500;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.hero-btn.primary {
  background-color: var(--color-primary);
  color: white;
}

.hero-btn.primary:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.hero-btn.ghost {
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.hero-btn.ghost:hover {
  background-color: color-mix(in srgb, var(--color-primary) 10%, transparent);
  transform: translateY(-2px);
}

/* --- 4. About Section --- */

#about-section h3 {
  margin-top: var(--spacing-unit);
  color: var(--color-primary);
}

.block-title {
  margin-top: 3rem;
  font-size: 1.5rem;
  color: var(--color-primary);
}

/* Grid layout */
.tech-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* Cards */
.tech-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 1rem 1.2rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow-subtle);
}

.tech-card:hover {
  transform: translateY(-4px);
  /* box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08); */
  box-shadow: 0 12px 32px
    color-mix(in srgb, var(--color-primary) 25%, transparent);
}

/* Icon */
.tech-card span {
  font-size: 1.5rem;
  display: block;
}

/* Card title */
.tech-card h4 {
  margin: 0.4rem 0;
  color: var(--color-primary);
  font-weight: 600;
}

/* Responsive for desktop */
@media (min-width: 600px) {
  .tech-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- 5. Systems Section (Projects) --- */

#portfolio-container {
  display: grid; /* Default to 1 column on mobile */
  grid-template-columns: 1fr;
  gap: 20px;
  padding-top: 1rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-main);
  box-shadow: var(--shadow-subtle);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.project-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  flex-shrink: 0;
}

.project-info {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1rem;
}

.project-info h4 {
  color: var(--color-primary);
  margin-top: 0;
}

/* Allow description to grow */
.project-body {
  flex-grow: 1;
}

.project-body p {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pin footer to bottom */
.project-footer {
  margin-top: auto;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--color-border);
}

.tech-stack {
  margin: 0.75rem 0;
}

.tech-tag {
  display: inline-block;
  background-color: var(--color-bg);
  color: var(--color-text-soft);
  padding: 4px 8px;
  border-radius: calc(var(--radius-main) / 3);
  font-size: 0.75rem;
  margin-right: 5px;
  margin-bottom: 5px;
}

.project-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: bold;
}

/* --- 6. Contact Section (Form) --- */

#contact-form {
  display: grid;
  gap: 1rem;
  padding-top: 1rem;
}

#contact-form input:not([type="checkbox"]),
#contact-form textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-sizing: border-box;
  background-color: var(--color-surface);
  color: var(--color-text-main);
  transition: border-color 0.2s;
}

#contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

#contact-form input:focus,
#contact-form textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px
    color-mix(in srgb, var(--color-primary) 20%, transparent);
}

#contact-form button[type="submit"] {
  background-color: var(--color-primary);
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s;
}

#contact-form button[type="submit"]:active {
  transform: translateY(1px);
}

#contact-form button[type="submit"]:hover {
  /* background-color: #0056b3; */
  opacity: 0.9;
}

.consent-group {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.consent-group label {
  line-height: 1.4;
  opacity: 0.8;
}

::placeholder {
  color: color-mix(in srgb, var(--color-text-main) 50%, transparent);
}

.contact-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--color-text-soft);
  margin-top: 1rem;
}

/* --- 7. Footer --- */

footer {
  margin-top: 4rem;
  padding: 1.5rem;

  background-color: color-mix(in srgb, var(--color-surface) 85%, transparent);
  backdrop-filter: blur(6px);

  border-radius: var(--radius-main) var(--radius-main) 0 0;
  box-shadow: 0 -6px 16px rgba(0, 0, 0, 0.03);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--content-max-width);
  margin: 0 auto;
}

footer p {
  margin: 0;
  opacity: 0.65;
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  gap: 1.2rem;
}

.footer-links a {
  text-decoration: none;
  color: var(--color-primary);
  font-weight: 500;
  font-size: 0.9rem;
  opacity: 0.85;
}

.footer-links a:hover {
  text-decoration: underline;
  opacity: 1;
}

@media (max-width: 500px) {
  .footer-content {
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
  }
}

/* ===================================================================
   DESKTOP MEDIA QUERY (Compact View for Large Screens)
   =================================================================== */

@media (min-width: 600px) {
  /* 1. Header: Slightly larger padding */
  #header {
    padding: 1rem var(--spacing-unit);
  }

  /* 2. Hero: Align image and text horizontally */
  #hero-section {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3rem;
    text-align: left;
    align-items: center;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  #hero-section img {
    /* Move image to the first column */
    margin: 0;
  }

  #hero-section h1 {
    /* Reset heading margin for grid layout */
    margin-top: 0;
  }

  .hero-actions {
    justify-content: flex-start; /* Desktop left */
  }

  /* 3. Works Section: Two-column grid */
  #portfolio-container {
    /* Two columns for desktop/tablet view */
    grid-template-columns: 1fr 1fr;
  }

  /* 4. Contact Form: Optional visual enhancement for two columns */
  /*
    #contact-form {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "name email"
            "message message"
            "consent consent"
            "submit submit";
    }
    #name { grid-area: name; }
    #senderEmail { grid-area: email; }
    #message { grid-area: message; }
    .consent-group { grid-area: consent; }
    #contact-form button { grid-area: submit; }
    */
}

/* ===================================================================
   DARK MODE OVERRIDES (Applies when body has .dark-mode class)
   =================================================================== */

body.dark-mode {
  --color-bg: #0f1115;
  --color-surface: #161a22;

  --color-text-main: #f1f1f1;
  --color-text-soft: #9aa0a6;

  --color-border: #262a35;

  --color-primary: #5fc4cf;

  --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.7);
}

body.dark-mode h2 {
  border-bottom-color: var(--color-primary);
}

body.dark-mode .tech-tag {
  background-color: color-mix(in srgb, var(--color-primary) 12%, #000);
  color: var(--color-text-main);
}
