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

html {
  font-size: 62.5%; /* 1rem = 10px for easier scaling */
}

/* Keep scrollbar space stable to avoid layout shift when navigating between pages */
html {
  overflow-y: scroll; /* always show vertical scrollbar area */
  scrollbar-gutter: stable both-edges;
}

/* Theme variables */
:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --muted: #bdbdbd;
  --text: #e0e0e0;
  --accent: #66b3ff;
  --max-content-width: 1200px;
  --container-padding: clamp(1rem, 2.5vw, 2.4rem);
  --header-height: 5.6rem; /* 56px - slightly more compact */
  --nav-font-size: 1.6rem;
  /* Spacing scale */
  --space-1: 0.6rem;
  --space-2: 1.2rem;
  --space-3: 2.4rem;
  --space-4: 3.6rem;
  /* Type scale (fluid) */
  --type-body: clamp(1.4rem, 1.6vw, 1.8rem);
  --type-lg: clamp(1.8rem, 2.4vw, 2.4rem);
  --type-xl: clamp(2.4rem, 4vw, 4.2rem);
}

[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f6f6f6;
  --muted: #555555;
  --text: #111111;
  --accent: #0066cc;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Montserrat', sans-serif;
  line-height: 1.6;
  margin: 0;
  padding-top: calc(var(--header-height) + 1.2rem); /* Prevent content from hiding under fixed header */
  font-size: var(--type-body);
}

/* Make footer stick to bottom when content is short */
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
main { flex: 1 0 auto; }

/* Skip link (accessible "Skip to main content") */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  width: auto;
  height: auto;
  padding: 0.8rem 1.2rem;
  background: #66b3ff;
  color: #121212;
  z-index: 200;
  border-radius: 4px;
}

/* Typography */
h1,
h2 {
  margin-bottom: var(--space-2);
}

h1 { font-size: var(--type-xl); }
h2 { font-size: var(--type-lg); }

p {
  font-size: 1.6rem;
  line-height: 1.6;
}

a {
  color: #66b3ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--max-content-width);
  margin-inline: auto;
  padding-inline: var(--container-padding);
  padding-block: var(--space-3);
}


/* ----------------------------
   Header
----------------------------- */
.header {
  background: rgba(28,28,28,0.75);
  backdrop-filter: blur(6px);
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.header__menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.header__menu ul {
  display: flex;
  align-items: center;
  justify-content: center; /* center the navigation items */
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1; /* allow the nav to grow so controls stay on right */
}

/* Nav link underline animation + active state */
.header__menu-link {
  position: relative;
}
.header__menu-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -0.6rem;
  height: 3px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 160ms ease, opacity 160ms ease;
  opacity: 0;
}
.header__menu-link:hover::after,
.header__menu-link:focus::after {
  transform: scaleX(1);
  opacity: 1;
}
.header__menu-link.active {
  color: var(--accent);
}
.header__menu-link.active::after {
  transform: scaleX(1);
  opacity: 1;
}

/* Micro-interactions */
.header__menu-link:hover, .header__menu-link:focus { transform: translateY(-3px); }
.header__menu-link { transition: transform 140ms ease, color 140ms ease; }

.nav-toggle:active, .theme-toggle:active, button:active { transform: translateY(1px) scale(0.995); }
.theme-toggle:active { box-shadow: inset 0 0 8px rgba(0,0,0,0.25); }

/* Small animation hook for theme toggle */
.theme-anim { transform: rotate(20deg); transition: transform 260ms ease; }

/* Smooth theme transitions */
body, .site-footer, .blog-post, .header {
  transition: background-color 220ms ease, color 220ms ease;
}

/* Contact socials alignment */
.contact-socials a {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  color: var(--text);
}
.contact-socials img { width: 48px; height: 48px; object-fit: contain }

.header__brand img { display: block; height: 3.2rem; width: auto }
.header__brand { margin-right: 1rem }
.header__controls { display: flex; gap: 0.6rem; align-items: center; margin-left: 1rem }
.theme-toggle { background: transparent; border: none; color: var(--text); font-size: 1.8rem; height: 100%; line-height: var(--header-height); padding: 0 0.6rem; cursor: pointer }

/* Make toggles easier to tap on touch devices */
.nav-toggle,
.theme-toggle {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

/* Mobile nav toggle button */
.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 2.2rem;
  cursor: pointer;
  height: 100%;
  line-height: var(--header-height);
  padding: 0 0.6rem;
}

.header__menu ul.is-open {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: flex-start;
}

.header__menu-link {
  color: #fff;
  font-weight: 600;
  font-size: var(--nav-font-size);
  padding: 0 1rem;
  transition: color 0.3s ease, transform 0.12s ease;
  font-family: 'Montserrat', sans-serif;
  line-height: var(--header-height);
  display: inline-block;
}

.header__menu-link:hover {
  color: #66b3ff;
}

/* ----------------------------
   Sections
----------------------------- */
.HelloWorld,
.whoami {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.texto1 p,
.texto p {
  max-width: 65ch;
  margin: 0 auto;
  font-size: var(--type-body);
}

/* ----------------------------
   About Image
----------------------------- */
.about-img {
  display: block;
  max-width: 600px; /* smaller image */
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 10px; /* optional: looks cleaner */
}

/* About page layout improvements */
.about-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: var(--space-3);
  align-items: start;
}
.about-media { text-align: center }
.about-bio { color: var(--text); }
.about-bio .lead { font-size: var(--type-lg); color: var(--muted); margin-bottom: var(--space-2) }
.what-list { list-style: disc; margin-left: 1.2rem; }
.skills { display:flex; gap:.6rem; flex-wrap:wrap; margin-top:.6rem }
.skills span { background: rgba(255,255,255,0.04); padding:.4rem .6rem; border-radius:6px; font-weight:600; font-size:1.4rem }
.socials { display:flex; gap:.6rem; justify-content:center; margin-top:var(--space-2) }
.about-media .button { display:inline-block }

@media (max-width: 768px) {
  .about-grid { grid-template-columns: 1fr; text-align: center }
  .about-bio { text-align: left }
  .about-media { order: -1 }
}

/* ----------------------------
   Blog Styles
----------------------------- */
.blog-wrapper {
  text-align: center;       /* Center-align the header and content */
  padding: 40px 0;          /* Adds space around the blog section */
}

/* Blog layout: main + sidebar for recent posts */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-3);
  align-items: start;
}
.blog-main { min-width: 0 }
.recent-posts { background: transparent; padding: var(--space-2); border-radius: 8px }
.recent-posts h2 { margin-top: 0 }
.recent-posts a { color: var(--accent); font-weight:600 }

/* Recent posts sidebar cards */
.recent-post-card { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.2rem; padding-bottom: 1.2rem; border-bottom: 1px solid rgba(255,255,255,0.02) }
.recent-post-card:last-child { border-bottom: none; padding-bottom: 0 }
.recent-post-thumb { width: 100%; height: 140px; object-fit: cover; border-radius: 6px }
.recent-post-content h3 { margin: 0; font-size: 1.4rem }
.recent-post-excerpt { margin: 0.4rem 0 0 0; font-size: 1.3rem; color: var(--muted); line-height: 1.4 }

@media (max-width: 900px) {
  .blog-layout { grid-template-columns: 1fr; }
  .recent-posts { order: -1 }
}

/* Responsive blog grid for indexes and archives */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(1rem, 2.5vw, 1.6rem);
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--container-padding);
}

/* Blog Post Styling (card with optional thumbnail) */
.blog-post {
  display: flex;
  gap: 1.6rem;
  align-items: flex-start;
  padding: 1.6rem;
  margin: 1.6rem auto;
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 8px;
  background-color: var(--surface);
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  max-width: 900px;
  text-align: left;
}

.blog-post img {
  width: 160px;
  height: 100px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.blog-post h2 {
  font-size: 1.8rem;
  margin: 0 0 0.6rem 0;
}

.blog-post p { margin: 0 0 0.8rem 0; color: var(--muted); }

.blog-post a { color: var(--accent); text-decoration: none; font-weight:600 }
.blog-post a:hover { text-decoration: underline }

.blog-meta { font-size: 1.4rem; color: var(--muted); margin-top: 0.6rem }

/* ----------------------------
   Hero
----------------------------- */
.hero {
  background: linear-gradient(180deg, rgba(0,0,0,0.02), transparent);
  padding-block: var(--space-4);
}
.hero__inner {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: var(--space-3);
  align-items: center;
}
.hero__content { text-align: left; }
.hero .lead { color: var(--muted); margin-bottom: var(--space-2); font-size: var(--type-lg); }
.hero__media img { border-radius: 12px; display: block; margin-inline: auto }

/* Buttons used in hero */
.button {
  display: inline-block;
  padding: 0.8rem 1.2rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  margin-right: 0.6rem;
}
.button--ghost { background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,0.06); }

/* ----------------------------
   Cookie Banner (bottom)
----------------------------- */
.cookie-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1200;
  background: var(--surface);
  color: var(--text);
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
}
.cookie-banner .cookie-inner {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.cookie-banner p { margin: 0; color: var(--muted); }
.cookie-banner .cookie-accept,
.cookie-banner .cookie-decline {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}
.cookie-banner .cookie-accept { background: var(--accent); color: #fff; font-weight:700 }
.cookie-banner .cookie-decline { background: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,0.04) }


/* ----------------------------
   Responsive Design
----------------------------- */
@media (max-width: 768px) {
  :root { --header-height: 4.8rem; }
  .container {
    width: 90%;
  }

  .hero__inner { grid-template-columns: 1fr; text-align: center }
  .hero__content { margin-bottom: var(--space-2) }
  .hero__media { display: none }

  /* Hide the full menu on mobile until toggled */
  .header__menu ul {
    display: none;
    flex-direction: column;
    text-align: center;
  }

  .nav-toggle { display: inline-block }

  /* When open, show the dropdown panel */
  .header__menu ul.is-open {
    display: flex;
    position: absolute;
    top: calc(var(--header-height) + 0.6rem);
    left: 1rem;
    right: 1rem;
    background: var(--surface);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  }

  .header__menu-link {
    font-size: 1.6rem;
  }

  h1,
  h2 {
    font-size: 2.5rem;
  }

  .meta-info,
  .tags {
    font-size: 1.4rem;
  }

  .body-content {
    font-size: 1.4rem;
  }

  /* Stack contact section elements vertically on smaller screens */
  .contact-container {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 768px) {
  /* Stack blog posts vertically and make thumbnails responsive */
  .blog-post {
    flex-direction: column;
    align-items: center;
    padding: 1.2rem;
  }

  .blog-post img {
    width: 100%;
    height: auto;
    max-width: 420px;
    margin-bottom: 0.8rem;
  }

  /* Slightly larger about image on small screens */
  .about-img {
    max-width: 180px;
  }
}

@media (max-width: 480px) {
  .container { width: 95%; }
  p { font-size: 1.5rem; }
  .header__brand { margin-right: 0.6rem; }
  .header__controls { gap: 0.4rem; }
}

form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 500px;
  margin: 20px auto;
  text-align: left;
}

/* Focus outlines for accessibility */
a:focus, button:focus, input:focus, textarea:focus {
  outline: 3px solid rgba(102,179,255,0.35);
  outline-offset: 3px;
}

/* Footer */
.site-footer {
  background: var(--surface);
  color: var(--muted);
  padding: 2.4rem 0;
  text-align: center;
  margin-top: 4rem;
  border-top: 1px solid rgba(255,255,255,0.03);
}
.site-footer a { color: var(--accent); font-weight:600 }

input[type="email"],
textarea,
input[type="file"] {
  padding: 10px;
  border-radius: 5px;
  border: none;
  font-size: 1.6rem;
}

button {
  padding: 10px;
  background-color: #66b3ff;
  color: #121212;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.6rem;
  transition: background-color 0.3s ease;
}

button:hover {
  background-color: #3399ff;
}

.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.about-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.row {
  display: flex;
  justify-content: center;  /* Center the content horizontally */
  gap: clamp(1rem, 4vw, 2.4rem);  /* Apply fluid gap between the two sections */
  width: 100%;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.contact-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  padding: 40px 20px;
  flex-wrap: wrap; /* Ensures responsiveness on mobile */
  max-width: 1200px;
  margin: 0 auto;
}

.contact-links {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.contact-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-socials,
.contact-form {
  flex: 1 1 300px;
  max-width: 500px;
}

.contact-form form label {
  margin-bottom: 10px;
}

.contact-form form input, 
.contact-form form textarea, 
.contact-form form button {
  padding: 10px;
  font-size: 1.6rem;
}

.contact-form form button {
  background-color: #007BFF;
  color: white;
  border: none;
  cursor: pointer;
}

.contact-form form button:hover {
  background-color: #0056b3;
}

/* Adjust the layout on smaller screens */
@media (max-width: 768px) {
  .contact-container {
    flex-direction: column;
    align-items: center;
  }

  .contact-links,
  .contact-form {
    flex: unset;
    width: 100%;
    margin-bottom: 20px;
  }
}

/* New contact page styles */
.contact-section { padding-block: var(--space-4); }
.contact-card { background: var(--surface); border-radius: 10px; padding: var(--space-3); }
.contact-grid { display: grid; grid-template-columns: 320px 1fr; gap: var(--space-3); align-items:start; }
.contact-grid .panel { background: transparent }
.contact-info h3 { margin-top: var(--space-1); }
.contact-list { list-style: none; padding:0; margin:0; color:var(--muted) }
.contact-list li { margin-bottom: 0.6rem }
.contact-list i { color: var(--accent); margin-right: 0.4rem; width: 1.2rem }
.form-label { display:block; margin-bottom: var(--space-2); font-size:1.4rem }
.form-label input, .form-label textarea, .form-row input[type="file"] { width:100%; padding:0.8rem; border-radius:8px; border:1px solid rgba(255,255,255,0.06); background:transparent; color:var(--text); }
.form-row { display:flex; gap:var(--space-2); align-items:center }

@media (max-width: 900px) {
  .contact-grid { grid-template-columns: 1fr; }
  .contact-info { text-align:center }
  .form-row { flex-direction: column; align-items: stretch }
}
