/* ============================================================
   PABLO CONTRERAS — PORTFOLIO
   style.css

   Table of Contents
   -----------------
   1. CSS Reset
   2. Root Variables
   3. Typography System
   4. Global Layout
   5. Header + Navigation
   6. Home Section
   7. About Section
   8. Case Study Section
   9. Contact Section
   10. Footer
   11. Responsive Rules
============================================================ */


/* ============================================================
   1. CSS RESET
============================================================ */

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

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

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

ul, ol {
  list-style: none;
}

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

button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}


/* ============================================================
   2. ROOT VARIABLES
============================================================ */

:root {

  /* Brand Palette */
  --accent-yellow:    #FFCC33;
  --accent-orange:    #FD9A31;
  --accent-redorange: #FF6600;
  --ink:              #121621;
  --slate:            #232C46;
  --graphite:         #454B56;
  --steel:            #6B7482;

  /* Functional Roles */
  --bg:               var(--graphite);
  --bg-alt:           var(--steel);
  --text:             var(--ink);
  --text-muted:       rgba(18, 22, 33, 0.7);
  --accent:           var(--accent-orange);
  --rule:             var(--slate);

  /* On-dark rendering tokens */
  --text-on-dark:       #F0EDE6;
  --text-muted-on-dark: rgba(240, 237, 230, 0.55);
  --rule-on-dark:       rgba(240, 237, 230, 0.1);

  /* Spacing Scale */
  --space-xs: 0.5rem;
  --space-s:  1rem;
  --space-m:  1.5rem;
  --space-l:  2.5rem;
  --space-xl: 4rem;

  /* Layout */
  --max-width:    1100px;
  --gutter:       24px;
  --margin-outer: 32px;

  /* Typography */
  --font-serif: "Playfair Display", serif;
  --font-sans:  "Inter", system-ui, -apple-system, BlinkMacSystemFont,
                "Segoe UI", Helvetica, Arial, sans-serif;
  --font-base:  var(--font-sans);

  /* Header */
  --header-height: 64px;
}


/* ============================================================
   3. TYPOGRAPHY SYSTEM
============================================================ */

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text-on-dark);
  background-color: var(--bg);
}

/* H1 */
h1 {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

/* H2 */
h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* H3 */
h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

/* Body prose */
p,
.home-intro {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 68ch;
}

p + p {
  margin-top: var(--space-m);
}

/* Pull quote */
blockquote {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.35;
  font-style: italic;
  border-left: 2px solid var(--accent);
  padding-left: var(--space-m);
  color: var(--text-on-dark);
}

/* Caption */
figcaption,
.caption {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.8125rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--text-muted-on-dark);
}

/* Overline / eyebrow */
.overline {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Emphasis inline */
em,
.emphasis {
  font-family: var(--font-sans);
  font-weight: 500;
  font-style: normal;
  color: var(--accent);
  letter-spacing: 0.01em;
}

/* Form labels (future-proof) */
label {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

a {
  transition: opacity 0.15s ease;
}

a:hover {
  opacity: 0.7;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}


/* ============================================================
   4. GLOBAL LAYOUT
============================================================ */

section {
  scroll-margin-top: var(--header-height);
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--margin-outer);
  padding-right: var(--margin-outer);
}

/* Section backgrounds — subtle vertical gradients, low-contrast, atmospheric */
#home       { background: linear-gradient(to bottom, #0e121b 0%, #161d2e 100%); }
#about      { background: linear-gradient(to bottom, #1e2740 0%, #273050 100%); }
#case-study { background: linear-gradient(to bottom, #3d444f 0%, #4e5561 100%); }
#contact    { background: linear-gradient(to bottom, #1e2740 0%, #1a2238 100%); }


/* ============================================================
   5. HEADER + NAVIGATION
============================================================ */

#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background-color: rgba(18, 22, 33, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(240, 237, 230, 0.07);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  height: var(--header-height);
  padding: 10px 0;
  flex-shrink: 0;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.site-logo svg {
  height: 42px;
  width: 42px;
}

.site-logo:hover {
  opacity: 0.8;
}

/* Primary nav — desktop */
#primary-nav ul {
  display: flex;
  align-items: center;
  gap: var(--space-l);
}

#primary-nav a {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--text-muted-on-dark);
  position: relative;
  padding-bottom: 2px;
}

#primary-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 1px;
  background-color: var(--accent);
  transition: width 0.2s ease;
}

#primary-nav a:hover {
  opacity: 1;
  color: var(--text-on-dark);
}

#primary-nav a:hover::after {
  width: 100%;
}

/* Mobile toggle — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: var(--header-height);
}

.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 1.5px;
  background-color: var(--text-on-dark);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

#primary-nav.nav-open {
  display: flex;
}


/* ============================================================
   6. HOME SECTION
============================================================ */

#home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--header-height);
}

.home-inner {
  width: 100%;
}

.home-content {
  max-width: 800px;
}

/* Subtitle rendered LARGE — visually dominant, semantically a <p> */
.home-subtitle {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(3rem, 6vw, 4.75rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-bottom: var(--space-s);
  max-width: none;
}

/* Name as H1 — smaller than subtitle, correct semantic weight */
#home h1 {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: clamp(1.375rem, 2.5vw, 1.875rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-muted-on-dark);
  margin-bottom: var(--space-l);
}

.home-intro {
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-muted-on-dark);
  margin-bottom: var(--space-m);
}

.home-links {
  margin-top: var(--space-l);
}

.home-links ul {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-on-dark);
}

.arrow-link::before {
  content: "→";
  color: var(--accent);
  transition: transform 0.2s ease;
}

.arrow-link:hover {
  opacity: 1;
  color: var(--accent);
}

.arrow-link:hover::before {
  transform: translateX(4px);
}


/* ============================================================
   7. ABOUT SECTION
============================================================ */

#about {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-height) + var(--space-xl));
  padding-bottom: var(--space-xl);
}

/* Two-column layout */
.about-inner {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: var(--space-xl);
  align-items: start;
  width: 100%;
}

/* Portrait column */
.about-portrait {
  position: sticky;
  top: calc(var(--header-height) + var(--space-l));
}

.portrait-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: center top;
}

/* Text column */
.about-text h2 {
  color: var(--text-on-dark);
  margin-bottom: var(--space-l);
}

.about-text p {
  color: var(--text-muted-on-dark);
}

.about-subsection {
  margin-top: var(--space-l);
  padding-top: var(--space-l);
  border-top: 1px solid var(--rule-on-dark);
}

.about-subsection h3 {
  color: var(--text-on-dark);
  margin-bottom: var(--space-m);
}

.about-subsection p {
  color: var(--text-muted-on-dark);
}

/* Prose lists */
.prose-list {
  margin-top: var(--space-s);
  margin-bottom: var(--space-m);
  padding-left: var(--space-m);
}

.prose-list li {
  position: relative;
  color: var(--text-muted-on-dark);
  padding-left: var(--space-s);
  margin-bottom: var(--space-xs);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 68ch;
}

ul.prose-list li::before {
  content: "—";
  position: absolute;
  left: calc(-1 * var(--space-s));
  color: var(--accent);
  font-weight: 400;
}

ol.prose-list {
  counter-reset: prose-counter;
}

ol.prose-list li {
  counter-increment: prose-counter;
}

ol.prose-list li::before {
  content: counter(prose-counter, decimal-leading-zero);
  position: absolute;
  left: calc(-1 * var(--space-m));
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  top: 0.25em;
}


/* ============================================================
   8. CASE STUDY SECTION
============================================================ */

#case-study {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--header-height) + var(--space-xl));
  padding-bottom: var(--space-xl);
}

.case-study-inner {
  width: 100%;
}

.case-study-content {
  max-width: 780px;
}

#case-study h2 {
  color: var(--text-on-dark);
  margin-bottom: var(--space-xs);
}

.case-study-note {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted-on-dark);
  margin-bottom: var(--space-l);
  margin-top: 0;
  max-width: none;
}

.case-study-block {
  margin-top: var(--space-l);
  padding-top: var(--space-l);
  border-top: 1px solid var(--rule-on-dark);
}

.case-study-block:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.case-study-block h3 {
  color: var(--text-on-dark);
  margin-bottom: var(--space-m);
}

.case-study-block p {
  color: var(--text-muted-on-dark);
}


/* ============================================================
   9. CONTACT SECTION
============================================================ */

#contact {
  padding-top: calc(var(--header-height) + var(--space-xl));
  padding-bottom: var(--space-xl);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

#contact .container {
  width: 100%;
}

#contact h2 {
  color: var(--text-on-dark);
  margin-bottom: var(--space-m);
}

#contact > .container > p {
  color: var(--text-muted-on-dark);
  margin-bottom: var(--space-l);
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-m);
}

.contact-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
}

.contact-label {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.contact-list a {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-on-dark);
  text-decoration: underline;
  text-decoration-color: var(--rule-on-dark);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, opacity 0.15s ease;
}

.contact-list a:hover {
  opacity: 1;
  text-decoration-color: var(--accent);
}


/* ============================================================
   10. FOOTER
============================================================ */

#site-footer {
  background-color: var(--ink);
  border-top: 1px solid rgba(240, 237, 230, 0.07);
  padding: var(--space-m) 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

#site-footer p {
  font-size: 0.8125rem;
  color: var(--text-muted-on-dark);
  letter-spacing: 0.02em;
  max-width: none;
}


/* ============================================================
   11. RESPONSIVE RULES
============================================================ */

/* ---- Tablet: ≤ 900px ---- */
@media (max-width: 900px) {

  /* About: collapse to one column */
  .about-inner {
    grid-template-columns: 1fr;
    gap: var(--space-l);
  }

  .about-portrait {
    position: static;
  }

  .portrait-placeholder {
    aspect-ratio: 4 / 3;
    max-height: 320px;
  }

  .home-content {
    max-width: 100%;
  }

}

/* ---- Tablet: ≤ 768px ---- */
@media (max-width: 768px) {

  :root {
    --margin-outer: 20px;
  }

  /* Typography scale */
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.625rem; }

  /* Mobile nav */
  .nav-toggle {
    display: flex;
  }

  #primary-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background-color: var(--ink);
    border-bottom: 1px solid rgba(240, 237, 230, 0.08);
    padding: var(--space-m) var(--margin-outer);
  }

  #primary-nav.nav-open {
    display: block;
  }

  #primary-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-m);
  }

  #primary-nav a {
    font-size: 1rem;
  }

  /* Sections — reduce top padding */
  #about,
  #case-study {
    padding-top: calc(var(--header-height) + var(--space-l));
    padding-bottom: var(--space-l);
  }

}

/* ---- Mobile: ≤ 480px ---- */
@media (max-width: 480px) {

  h1 { font-size: 2rem; }
  h2 { font-size: 1.375rem; }
  h3 { font-size: 1.125rem; }

  .home-subtitle {
    font-size: 1.5rem;
  }

  #home h1 {
    font-size: 1.125rem;
  }

  .about-subsection,
  .case-study-block {
    margin-top: var(--space-m);
    padding-top: var(--space-m);
  }

  .portrait-placeholder {
    aspect-ratio: 1 / 1;
    max-height: 280px;
  }

}
