/* ==========================================================================
   Diego Jiménez Wiseheart — diegowiseheart.com
   Single stylesheet. Editorial design system.
   ========================================================================== */

/* --- Custom Properties --- */
:root {
  --bg: #f5f1eb;
  --fg: #1a1917;
  --muted: #8a8378;
  --rule: #d5cdc0;
  --accent: #1a1917;
  --bg-hover: #eee9e0;
  --font-heading: 'Instrument Serif', Georgia, serif;
  --font-body: 'Hanken Grotesk', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
  --max-text: 720px;
  --max-grid: 960px;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

ul, ol {
  list-style: none;
}

/* --- Skip to Content --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--fg);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.skip-link:focus {
  top: 16px;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.2;
}

h1 {
  font-size: clamp(32px, 5vw, 56px);
}

h2 {
  font-size: clamp(26px, 3.5vw, 38px);
}

h3 {
  font-size: clamp(22px, 2.5vw, 28px);
}

p + p {
  margin-top: 1.5em;
}

/* Monospace labels */
.label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
}

/* Body link style */
.body-link {
  position: relative;
  display: inline;
}

.body-link::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.body-link:hover::after {
  transform: scaleX(1);
}

/* --- Focus Styles --- */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

/* --- Layout --- */
.container {
  max-width: var(--max-text);
  margin: 0 auto;
  padding: 0 24px;
}

.container--wide {
  max-width: var(--max-grid);
}

/* --- Navigation --- */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 24px;
  max-width: var(--max-grid);
  margin: 0 auto;
}

.nav-logo {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 24px;
  color: var(--fg);
  text-decoration: none;
  line-height: 1;
}

.nav-logo:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.nav-links a:hover::after,
.nav-links a[aria-current="page"]::after {
  transform: scaleX(1);
}

/* --- Hero Section (Homepage) --- */
.hero {
  padding: 80px 24px 60px;
  max-width: var(--max-text);
  margin: 0 auto;
  position: relative;
}

.hero-coords {
  position: absolute;
  top: 40px;
  right: 24px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  opacity: 0.4;
  will-change: transform;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 12px;
}

.hero-location {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 32px;
}

.hero-headline {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.55;
  max-width: 600px;
  margin-bottom: 36px;
}

.hero-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fg);
  position: relative;
}

.hero-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.hero-links a:hover::after {
  transform: scaleX(1);
}

/* --- Divider Lines --- */
.draw-line {
  height: 1px;
  background: var(--rule);
  border: none;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1s var(--ease);
  margin: 0 auto;
  max-width: var(--max-grid);
}

.draw-line.visible {
  transform: scaleX(1);
}

.section-divider {
  padding: 0 24px;
  max-width: calc(var(--max-grid) + 48px);
  margin: 0 auto;
}

/* --- Sections --- */
.section {
  padding: 80px 24px;
  max-width: var(--max-grid);
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 48px;
}

/* --- Work Rows --- */
.work-row {
  display: flex;
  gap: 24px;
  padding: 24px 16px;
  border-radius: 2px;
  transition: background 0.3s var(--ease), padding-left 0.3s var(--ease);
  cursor: default;
}

.work-row:hover {
  background: var(--bg-hover);
  padding-left: 24px;
}

.work-row + .work-row {
  margin-top: 8px;
}

.work-index {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 300;
  color: var(--muted);
  flex-shrink: 0;
  width: 32px;
  padding-top: 3px;
}

.work-content {
  flex: 1;
}

.work-title {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.4;
  margin-bottom: 4px;
}

.work-desc {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
}

/* --- Latest / Writing Entries --- */
.writing-entry {
  display: block;
  padding: 24px 16px;
  border-radius: 2px;
  transition: background 0.3s var(--ease), padding-left 0.3s var(--ease);
  text-decoration: none;
  color: var(--fg);
}

.writing-entry:hover {
  background: var(--bg-hover);
  padding-left: 24px;
}

.writing-entry + .writing-entry {
  margin-top: 8px;
}

.writing-date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.writing-title {
  font-family: var(--font-heading);
  font-size: clamp(22px, 2.5vw, 28px);
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: 8px;
}

.writing-desc {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 12px;
}

.writing-cta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fg);
}

/* --- Page Header (About, Writing) --- */
.page-header {
  padding: 80px 24px 48px;
  max-width: var(--max-text);
  margin: 0 auto;
}

.page-header .section-label {
  margin-bottom: 16px;
}

.page-title {
  font-family: var(--font-heading);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 16px;
}

.page-subtitle {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
}

/* --- Article (Blog Post) --- */
.article {
  max-width: var(--max-text);
  margin: 0 auto;
  padding: 0 24px 80px;
}

.article-header {
  padding: 80px 24px 48px;
  max-width: var(--max-text);
  margin: 0 auto;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 24px;
}

.article-title {
  font-family: var(--font-heading);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 400;
  line-height: 1.15;
  margin-bottom: 16px;
}

.article-subtitle {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.55;
  color: var(--muted);
}

.article p {
  margin-top: 1.5em;
}

.article p:first-child {
  margin-top: 0;
}

.article h2 {
  font-family: var(--font-heading);
  font-size: clamp(26px, 3.5vw, 34px);
  margin-top: 3em;
  margin-bottom: 0.5em;
}

.article h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 20px;
  margin-top: 2.5em;
  margin-bottom: 0.5em;
}

.article .lede {
  font-size: 19px;
  line-height: 1.6;
}

.article .pull-quote {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: clamp(22px, 2.8vw, 28px);
  line-height: 1.45;
  padding: 32px 0;
  margin: 2em 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  color: var(--fg);
}

.article .timestamp {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-top: 2.5em;
  margin-bottom: 0.5em;
}

.article em {
  font-style: italic;
}

.article-back {
  display: inline-block;
  margin-top: 48px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--fg);
  position: relative;
}

.article-back::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.article-back:hover::after {
  transform: scaleX(1);
}

/* --- About Page --- */
.about-body {
  max-width: var(--max-text);
  margin: 0 auto;
  padding: 0 24px 48px;
}

.about-body p {
  margin-top: 1.5em;
}

.about-body p:first-child {
  margin-top: 0;
}

.about-contact {
  max-width: var(--max-text);
  margin: 0 auto;
  padding: 0 24px 80px;
}

.about-contact p {
  margin-top: 8px;
}

.about-contact .contact-line {
  font-size: 18px;
}

.about-contact .contact-secondary {
  font-size: 14px;
  color: var(--muted);
}

.about-contact .contact-secondary a {
  color: var(--muted);
  position: relative;
}

.about-contact .contact-secondary a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--muted);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.about-contact .contact-secondary a:hover::after {
  transform: scaleX(1);
}

/* --- Writing Index --- */
.writing-list {
  max-width: var(--max-grid);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* --- Footer --- */
.site-footer {
  padding: 0 24px;
  max-width: calc(var(--max-grid) + 48px);
  margin: 0 auto;
}

.footer-rule {
  height: 1px;
  background: var(--rule);
  border: none;
  margin-bottom: 32px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 24px;
}

.footer-left,
.footer-right {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 48px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--muted);
}

.footer-links span {
  color: var(--rule);
}

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

.footer-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--muted);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

.footer-links a:hover::after {
  transform: scaleX(1);
}

/* --- Scroll Reveal Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for children */
.stagger-1 { transition-delay: 0s; }
.stagger-2 { transition-delay: 0.08s; }
.stagger-3 { transition-delay: 0.16s; }
.stagger-4 { transition-delay: 0.24s; }
.stagger-5 { transition-delay: 0.32s; }
.stagger-6 { transition-delay: 0.4s; }

/* Page load animation */
.hero-load {
  opacity: 0;
  transform: translateY(16px);
  animation: heroIn 0.6s var(--ease) forwards;
}

.hero-load-1 { animation-delay: 0s; }
.hero-load-2 { animation-delay: 0.15s; }
.hero-load-3 { animation-delay: 0.3s; }

@keyframes heroIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .draw-line {
    transform: scaleX(1);
    transition: none;
  }

  .hero-load {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .hero-coords {
    will-change: auto;
  }

  .work-row,
  .writing-entry,
  .nav-links a::after,
  .hero-links a::after,
  .body-link::after,
  .article-back::after,
  .footer-links a::after,
  .about-contact .contact-secondary a::after {
    transition: none;
  }
}

/* --- Responsive --- */

/* Tablet */
@media (max-width: 959px) {
  .hero {
    padding: 60px 24px 48px;
  }

  .section {
    padding: 60px 24px;
  }

  .hero-coords {
    top: 24px;
    right: 24px;
  }
}

/* Mobile */
@media (max-width: 599px) {
  .site-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
  }

  .nav-links {
    gap: 20px;
  }

  .hero {
    padding: 48px 24px 40px;
  }

  .hero-coords {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: 24px;
  }

  .hero-name {
    font-size: clamp(32px, 8vw, 40px);
  }

  .section {
    padding: 48px 24px;
  }

  .section-label {
    margin-bottom: 32px;
  }

  .work-row {
    flex-direction: column;
    gap: 4px;
  }

  .work-index {
    width: auto;
    padding-top: 0;
  }

  .footer-content {
    flex-direction: column;
    gap: 8px;
  }

  .footer-links {
    flex-direction: column;
    gap: 8px;
  }

  .page-header {
    padding: 48px 24px 32px;
  }

  .article-header {
    padding: 48px 24px 32px;
  }
}

/* ── Language Banner ──────────────────────────────────────────────────────────────────────── */
.lang-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 34px;
  background: #ebe7df;
  border-bottom: 1px solid #c8bfb0;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lang-banner-text {
  color: #8a8078;
}
.lang-banner-link {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6e675e;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: #b8b0a4;
}
.lang-banner-link:hover,
.lang-banner-link:focus-visible {
  color: var(--fg);
  text-decoration-color: var(--fg);
}

/* --- Article inline links — always-visible subtle underline --- */
.article .body-link::after {
  transform: scaleX(1);
  background: var(--rule);
  transition: background 0.3s var(--ease);
}

.article .body-link:hover::after {
  background: var(--fg);
}
