/* Jorge Gato — jorgegato.com
   Dark tropical night. Quiet, readable, not kitschy. No framework. */

:root {
  --bg: #0d1f24;
  --bg-mid: #10262b;
  --bg-raised: #152c31;
  --bg-raised-hover: #1a353b;
  --ink: #e8e4dc;
  --ink-soft: #c4bfb4;
  --ink-muted: #a39e94;
  --line: #2a4548;
  --accent: #2ec4c6;
  --accent-soft: #7ee8e6;
  --accent-dim: rgba(46, 196, 198, 0.16);
  --mango: #ffc857;
  --coral: #ff8a65;
  --hibiscus: #ff6f91;
  --palm: #3d8f6e;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 42rem;
  --pad: clamp(1.25rem, 5vw, 2.25rem);
  --font-serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(ellipse 90% 48% at 50% -12%, rgba(255, 138, 101, 0.16), transparent 58%),
    radial-gradient(ellipse 55% 32% at 80% -4%, rgba(255, 200, 87, 0.10), transparent 55%),
    radial-gradient(ellipse 50% 28% at 16% 2%, rgba(46, 196, 198, 0.08), transparent 52%),
    var(--bg);
  font-family: var(--font-sans);
  font-size: clamp(1.05rem, 0.98rem + 0.3vw, 1.1875rem);
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-color: rgba(46, 196, 198, 0.42);
  text-underline-offset: 0.18em;
  transition: color 0.25s var(--ease), text-decoration-color 0.25s var(--ease);
}

a:hover {
  color: var(--accent-soft);
  text-decoration-color: var(--accent-soft);
}

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

.skip-link {
  position: absolute;
  left: var(--pad);
  top: 0.75rem;
  z-index: 100;
  padding: 0.4rem 0.7rem;
  background: var(--bg-raised);
  color: var(--ink);
  border-radius: 6px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header / nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: 0 auto;
  padding: 0.85rem var(--pad);
}

.nav-mark {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}

.nav-mark:hover {
  color: var(--accent-soft);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: clamp(0.85rem, 3vw, 1.5rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  position: relative;
}

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

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

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  transform: scaleX(1);
}

#top,
#lately,
#background,
#day,
#hello,
#quote {
  scroll-margin-top: 4.75rem;
}

/* Layout */
main {
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: 0 auto;
  padding: 0 var(--pad) 4.5rem;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: clamp(3.75rem, 10vw, 6.5rem);
  padding-bottom: 0.5rem;
}

.hero-palms {
  position: absolute;
  inset: -1.5rem 0 auto auto;
  width: min(18rem, 52vw);
  height: 22rem;
  pointer-events: none;
  z-index: 0;
  color: var(--palm);
}

.palm {
  position: absolute;
  opacity: 0.22;
  transform-origin: 55% 100%;
}

.palm-right {
  right: 0;
  top: 0;
  width: 78%;
  height: auto;
  animation: palm-sway 10s ease-in-out infinite;
}

.palm-left {
  right: 42%;
  top: 2.5rem;
  width: 52%;
  height: auto;
  opacity: 0.14;
  animation: palm-sway 13s ease-in-out infinite;
  animation-delay: -4s;
}

@keyframes palm-sway {
  0%, 100% { transform: rotate(-1.6deg); }
  50% { transform: rotate(2.2deg); }
}

.hero-kicker,
.hero-name,
.hero-intro {
  position: relative;
  z-index: 1;
}

.hero-kicker {
  margin: 0 0 0.85rem;
  color: var(--mango);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.hero-name {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 1.4rem + 4.4vw, 4.25rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.hero-intro {
  margin: 0;
  max-width: 28rem;
  color: var(--ink-soft);
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.4rem);
  line-height: 1.5;
}

/* Portrait / hero illustration */
.portrait-frame {
  margin: 0;
}

.portrait-card {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: #f4efe4;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.34),
    0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent),
    0 2px 8px rgba(0, 0, 0, 0.16);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.portrait-card:hover {
  transform: translateY(-3px);
  box-shadow:
    0 22px 56px rgba(0, 0, 0, 0.4),
    0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent),
    0 8px 28px rgba(46, 196, 198, 0.14);
}

.portrait-photo {
  width: 100%;
  height: auto;
  border-radius: 0;
  background: #f4efe4;
}

.portrait-caption {
  margin: 0.85rem 0.15rem 0;
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-style: italic;
  font-family: var(--font-serif);
  line-height: 1.5;
  max-width: 36rem;
}

/* Wave dividers */
.wave-divider {
  height: 2rem;
  margin: clamp(2.5rem, 6vw, 4.5rem) 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%);
}

.wave-divider::before {
  content: "";
  display: block;
  width: 130%;
  height: 100%;
  margin-left: -15%;
  background: url("../assets/wave.svg") center / 100% 100% no-repeat;
  animation: wave-drift 18s ease-in-out infinite;
}

@keyframes wave-drift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4%); }
}

/* Sections */
.section-title {
  margin: 0 0 0.6rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.25rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.section-title::before {
  content: "";
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  background: url("../assets/hibiscus.svg") center / contain no-repeat;
  opacity: 0.95;
}

.section-lead,
.day-copy {
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  max-width: 32rem;
}

.background-copy {
  max-width: 36rem;
}

.background-copy p {
  margin: 0 0 0.95rem;
  color: var(--ink-soft);
}

.background-copy p:last-child {
  margin-bottom: 0;
}

.day-block {
  display: flex;
  align-items: center;
  gap: 1.4rem 1.75rem;
}

.me-photo {
  margin: 0;
  flex: 0 0 auto;
  width: 8.75rem;
  text-align: center;
}

.me-photo-img {
  width: 8.75rem;
  height: 8.75rem;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.32),
    0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
  background: var(--bg-raised);
}

.me-photo-caption {
  margin: 0.55rem 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-style: italic;
  font-family: var(--font-serif);
  line-height: 1.35;
}

.day-copy {
  margin: 0;
  flex: 1;
  font-size: 1.12em;
}

@media (max-width: 520px) {
  .day-block {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Cards */
.cards {
  display: grid;
  gap: 1.1rem;
}

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 3vw, 1.6rem);
  transition:
    transform 0.35s var(--ease),
    border-color 0.3s var(--ease),
    background 0.3s var(--ease),
    box-shadow 0.35s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--bg-raised-hover);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.22),
    0 0 24px rgba(46, 196, 198, 0.12),
    0 0 18px rgba(255, 111, 145, 0.07);
}

.card-title {
  margin: 0 0 0.55rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.015em;
}

.card-body {
  margin: 0;
  color: var(--ink-soft);
}

.dog-list {
  list-style: none;
  margin: 1.45rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.55rem;
}

.dog {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.35rem 1.15rem;
  align-items: start;
}

.dog picture {
  display: block;
  width: 72px;
  height: 72px;
}

.dog-avatar {
  width: 72px;
  height: 72px;
  object-fit: cover;
  object-position: center;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 70%, var(--mango) 30%);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--mango) 35%, transparent),
    0 4px 12px rgba(0, 0, 0, 0.28);
  background: #10262b;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.dog:hover .dog-avatar {
  transform: scale(1.06);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--mango) 50%, transparent),
    0 6px 16px rgba(46, 196, 198, 0.22);
}

.dog-name {
  margin: 0 0 0.3rem;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.dog-line {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 1.6;
}

@media (max-width: 520px) {
  .dog {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }
}

/* Links */
.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.6rem;
}

.text-link {
  color: var(--ink);
  font-size: 1.1rem;
  text-decoration: none;
  position: relative;
  padding-bottom: 0.12em;
}

.text-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0.28);
  transform-origin: left;
  transition: transform 0.35s var(--ease), background 0.25s var(--ease);
}

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

.text-link:hover::after,
.text-link:focus-visible::after {
  transform: scaleX(1);
}

.hello .links {
  gap: 0.65rem;
}

.hello-link {
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  font-size: 1.02rem;
  text-decoration: none;
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-raised);
  transition:
    color 0.25s var(--ease),
    background 0.25s var(--ease),
    border-color 0.25s var(--ease),
    box-shadow 0.3s var(--ease);
}

.hello-link:hover,
.hello-link:focus-visible {
  color: var(--accent-soft);
  background: var(--bg-raised-hover);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 18px rgba(46, 196, 198, 0.14);
}

.quote-card {
  margin: 2rem 0 0;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.3rem, 3.2vw, 1.85rem);
}

.quote-kicker {
  margin: 0 0 0.85rem;
  color: var(--mango);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}

.quote-block {
  margin: 0;
}

.quote-text {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.18rem, 1rem + 0.7vw, 1.45rem);
  line-height: 1.45;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.quote-text::before {
  content: "“";
}

.quote-text::after {
  content: "”";
}

.quote-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1rem;
  margin: 1.05rem 0 0;
}

.quote-attribution {
  font-style: normal;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.quote-week {
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-family: var(--font-serif);
  font-style: italic;
}

/* Footer */
.site-footer {
  max-width: calc(var(--max) + 2 * var(--pad));
  margin: 0 auto;
  padding: 0 var(--pad) 3rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.mood {
  margin: 0 0 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.mood-img {
  width: 4.5rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  background: #1a8fb0;
}

.mood-label {
  margin: 0;
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.95rem;
}

.footer-copy,
.footer-line {
  margin: 0;
}

.footer-line {
  margin-top: 0.25rem;
  font-family: var(--font-serif);
  font-style: italic;
}

.visit-count {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.9rem 0 0;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.visit-count[hidden] {
  display: none !important;
}

.visit-count-icon {
  width: 1.25rem;
  height: 0.85rem;
  flex: 0 0 auto;
  color: var(--accent);
  opacity: 0.8;
}

.visit-count-text {
  font-family: var(--font-serif);
  font-style: italic;
}

.visit-count [data-visit-count-number] {
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

/* Motion: entrance + scroll reveals */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease);
}

.reveal.is-visible,
.hero .reveal.is-in {
  opacity: 1;
  transform: none;
}

.hero .reveal {
  transition-duration: 0.95s;
}

.hero .reveal:nth-child(1) { transition-delay: 0.05s; }
.hero .reveal:nth-child(2) { transition-delay: 0.18s; }
.hero .reveal:nth-child(3) { transition-delay: 0.32s; }

/* Palms are the first child of .hero, so kicker/name/intro are 2, 3, 4.
   Keep delays on the reveal elements themselves via adjacent structure:
   .hero-kicker.reveal etc. are nth-of-type unreliable. Use explicit classes. */
.hero-kicker.reveal { transition-delay: 0.05s; }
.hero-name.reveal { transition-delay: 0.18s; }
.hero-intro.reveal { transition-delay: 0.32s; }

.cards .reveal:nth-child(1) { transition-delay: 0.05s; }
.cards .reveal:nth-child(2) { transition-delay: 0.14s; }
.cards .reveal:nth-child(3) { transition-delay: 0.23s; }

.dog-list .dog:nth-child(1) { transition-delay: 0.04s; }
.dog-list .dog:nth-child(2) { transition-delay: 0.12s; }
.dog-list .dog:nth-child(3) { transition-delay: 0.2s; }

.links .reveal:nth-child(1) { transition-delay: 0.04s; }
.links .reveal:nth-child(2) { transition-delay: 0.12s; }
.links .reveal:nth-child(3) { transition-delay: 0.2s; }
.links .reveal:nth-child(4) { transition-delay: 0.28s; }

.background-copy .reveal:nth-child(1) { transition-delay: 0.04s; }
.background-copy .reveal:nth-child(2) { transition-delay: 0.12s; }
.background-copy .reveal:nth-child(3) { transition-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .hero .reveal,
  .card,
  .portrait-frame,
  .portrait-card,
  .nav-links a::after,
  .text-link::after,
  .palm,
  .palm-left,
  .palm-right,
  .wave-divider::before {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }

  .palm,
  .palm-left,
  .palm-right {
    opacity: 0.2 !important;
  }

  .palm-left {
    opacity: 0.14 !important;
  }

  .card:hover,
  .portrait-frame:hover,
  .portrait-card:hover,
  .dog:hover .dog-avatar {
    transform: none;
  }

  .dog-avatar {
    transition: none !important;
  }
}

/* 404 page */
.page-404 {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-404 main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.error-mood {
  margin: 0 0 1.25rem;
  width: min(16rem, 70vw);
}

.error-mood-img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.32),
    0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent);
  background: #1a8fb0;
}

.error-code {
  margin: 0 0 0.6rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(3.5rem, 8vw, 6rem);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--accent);
}

.error-title {
  margin: 0 0 0.8rem;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.error-copy {
  margin: 0 0 1.6rem;
  color: var(--ink-soft);
  max-width: 26rem;
}

/* Narrow phones */
@media (max-width: 400px) {
  .nav-links {
    gap: 0.5rem 0.7rem;
  }

  .nav-links a {
    font-size: 0.82rem;
  }

  .hero-palms {
    opacity: 0.85;
    width: min(14rem, 62vw);
    height: 16rem;
  }
}
