/* ==========================================================================
   Lucas Sanchez — portfolio site styles
   Warm editorial · ink and paper · mobile-first
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --bg-alt: #eeeae1;
  --bg-card: #f7f4ed;
  --border: #d3cec3;
  --text: #292b25;
  --text-muted: #626258;
  --accent: #a3422b;
  --accent-dim: #813321;
  --accent-soft: #e9d9cd;
  --focus: #a3422b;
  --radius: 2px;
  --container: 1160px;
  --shadow: none;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- Reset-ish ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
}

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.container-narrow {
  --container: 760px;
}

/* ---- Accessibility ---- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fffaf5;
  font-weight: 700;
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 244, 237, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  min-height: 5.5rem;
  gap: 1rem;
}

.nav-brand {
  margin-right: auto;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--text);
  text-decoration: none;
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Language switch ---- */
.lang-switch {
  display: inline-flex;
  gap: 2px;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0.3rem 0.65rem;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-btn:hover,
.lang-btn:focus-visible {
  color: var(--accent);
}

.lang-btn[aria-current="page"] {
  background: var(--text);
  color: var(--bg);
}

.lang-btn[aria-current="page"]:hover,
.lang-btn[aria-current="page"]:focus-visible {
  color: var(--bg);
}

.nav-brand-dot {
  color: var(--accent);
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-toggle-bar {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) 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(-7px) rotate(-45deg);
}

.nav-menu {
  display: none;
  list-style: none;
  margin: 0;
  padding: 1rem 0 1.25rem;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.nav-menu.open {
  display: flex;
}

.nav-link {
  display: block;
  padding: 0.55rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent);
}

.nav-link-cta {
  color: var(--accent);
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

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

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Hero ---- */
.hero {
  padding: clamp(4rem, 8vw, 7rem) 0 0;
}

.hero-kicker {
  margin: 0 0 1.5rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-title {
  margin: 0 0 1.75rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3.3rem, 7.8vw, 6.3rem);
  line-height: 1.03;
  letter-spacing: -0.055em;
  max-width: 15ch;
  text-wrap: balance;
}

.accent {
  color: var(--accent);
}

.hero-lede {
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  max-width: 49ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---- Sections ---- */
.section {
  padding: clamp(3.5rem, 8vw, 5.5rem) 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.3rem, 4vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.section-subtitle {
  margin: 0 0 2.5rem;
  color: var(--text-muted);
  max-width: 60ch;
}

/* ---- Service cards ---- */
.card-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

.card {
  border-top: 1px solid var(--border);
  padding: 1.4rem 0 0;
}

.card:hover {
  border-color: var(--accent-dim);
}

.card-title {
  margin: 0 0 0.6rem;
  font-size: 1.15rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.4;
}

.card-text {
  margin: 0;
  color: var(--text-muted);
}

/* ---- Projects ---- */
.project {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--border);
  padding: clamp(2rem, 4vw, 3.5rem) 0;
  margin: 0;
}

.project-title {
  margin: 0 0 0.6rem;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.project-stack {
  margin: 0 0 1rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
}

.project-desc {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.project-details {
  color: var(--text-muted);
}

.project-details summary {
  width: fit-content;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.project-details > :not(summary) {
  margin: 0.75rem 0 0;
}

.project-example {
  align-self: start;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: clamp(1.25rem, 3vw, 2rem);
}

.project-example h4 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  line-height: 1.4;
}

.project-example p {
  margin: 0;
  color: var(--text-muted);
}

.project-example .project-details {
  margin-top: 0.75rem;
}

.project-example blockquote {
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}

.invoice-result {
  margin: 0;
}

.invoice-result figcaption {
  font-weight: 600;
}

.invoice-result .invoice-status {
  margin-top: 0.25rem;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
}

.invoice-amounts {
  margin: 1rem 0;
  border-block: 1px solid var(--border);
  padding-block: 0.75rem;
}

.invoice-amounts > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.invoice-amounts > div + div {
  margin-top: 0.35rem;
}

.invoice-amounts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---- How I work ---- */
.principles {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: principle;
}

.principle {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.principle:last-child {
  border-bottom: 0;
}

.principle-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.9;
}

.principle h3 {
  grid-column: 2;
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.principle p {
  grid-column: 2;
  margin: 0;
  color: var(--text-muted);
}

/* ---- Track record ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  list-style: none;
  margin: 0 0 3rem;
  padding: 0;
}

.stat {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  text-align: left;
}

.stat-num {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2.25rem, 7vw, 3.7rem);
  font-weight: 400;
  color: var(--accent);
  line-height: 1.1;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.45rem;
  top: 0.4rem;
  bottom: 0.4rem;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 2rem 2.25rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}

.timeline-org {
  margin: 0 0 0.15rem;
  font-size: 1.15rem;
}

.timeline-role {
  margin: 0 0 0.4rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

.timeline-desc {
  margin: 0;
  color: var(--text-muted);
}

/* ---- Certifications ---- */
.cert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cert {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
}

.cert-name {
  font-weight: 600;
}

.cert-org {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---- Contact ---- */
.contact {
  background: var(--bg-alt);
  text-align: left;
}

.contact-inner .section-title {
  max-width: 22ch;
  margin-inline: 0;
}

.contact-lede {
  color: var(--text-muted);
  max-width: 46ch;
  margin: 1.25rem 0 2rem;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.contact-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5rem 1.75rem;
  margin: 0;
  padding: 0;
}

.contact-link {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
}

.contact-link:hover,
.contact-link:focus-visible {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.footer-inner p {
  margin: 0;
}

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

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
}

.footer-links svg {
  width: 1rem;
  height: 1rem;
  flex: none;
}

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

/* ---- Reveal animations ---- */
.reveal {
  /* Content remains readable without JavaScript. */
  opacity: 1;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

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

@media (min-width: 768px) {
  .cert {
    grid-template-columns: minmax(0, 1fr) 11rem;
  }
}

@media (min-width: 900px) {
  .nav-toggle {
    display: none;
  }

  .nav-menu {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
    background: none;
    border: 0;
  }

  .nav-link {
    padding: 0.5rem 0.9rem;
  }

  .project {
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
  }
}


/* Editorial layout */
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.hero-kicker, .hero-title, .hero-lede, .hero-actions { grid-column: 1; }
.hero-title .accent { font-style: italic; }
.hero-actions .btn-primary { text-align: center; }
.hero-note {
  margin-top: 3.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}
.hero-note-label {
  font: 0.7rem var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.hero-note p { max-width: 30ch; margin: 0.75rem 0 1.25rem; }
.hero-note a { color: var(--accent); text-underline-offset: 5px; }
.hero-actions { align-items: center; gap: 0.75rem 1.5rem; }
.hero-actions .btn-ghost {
  padding-inline: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 6px;
}
.hero-actions .btn-ghost { color: var(--text-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.card-grid { counter-reset: service; gap: 2rem; }
.card::before {
  counter-increment: service;
  content: "0" counter(service);
  display: block;
  margin-bottom: 1.5rem;
  font: 0.75rem var(--mono);
  color: var(--accent);
}
.certifications .section-title { margin-bottom: 1.75rem; }
.contact .section-title { font-size: clamp(2.8rem, 6vw, 4.5rem); }
.contact-link { overflow-wrap: anywhere; }
@media (min-width: 900px) {
  .hero-inner { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); column-gap: 4rem; }
  .hero-note { grid-column: 2; grid-row: 2 / 5; align-self: end; margin: 0 0 0.5rem; }
  .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .project { column-gap: 4rem; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .btn,
  .card,
  .lang-btn,
  .nav-toggle-bar {
    transition: none;
  }
}
