/* ---------------------------------------------------------------------------
   Adrien Rahier — personal site
   Minimalist, editorial design system
--------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;

  /* Light theme — near-white / near-black neutrals, warm-saturated */
  --bg: #fbf9f6;
  --bg-accent: #fbe9de;
  --surface: #fefcfa;
  --text: #1c1a17;
  --text-muted: #6f6a63;
  --border: #e7e1d8;
  --accent: #d1653f;
  --accent-hover: #b34e2c;

  /* Logo cards stay light in both themes so dark logos remain legible */
  --logo-card: #fdfbf8;

  --measure: 46rem;
  --frame: 74rem;
  --space: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 14px;

  /* Spacing scale — every gap/margin is a multiple of 0.25rem (4px) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
}

[data-theme="dark"] {
  --bg: #14130f;
  --bg-accent: #2a1c14;
  --surface: #1d1b16;
  --text: #ece7df;
  --text-muted: #9c958a;
  --border: #302c25;
  --accent: #e8845f;
  --accent-hover: #f19a78;
}

/* Rule: don't use shadows in dark interfaces */
[data-theme="dark"] .link-row:hover,
[data-theme="dark"] .tooltip__bubble {
  box-shadow: none;
}

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

* {
  margin: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 1.0625rem;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--space);
}

.wrap-frame {
  width: 100%;
  max-width: var(--frame);
  margin-inline: auto;
  padding-inline: var(--space);
}

.site-main {
  flex: 1 0 auto;
  padding-block: clamp(2.5rem, 6vw, 4.5rem);
}

.site-main--center {
  display: flex;
  flex-direction: column;
}

.site-main--center > * {
  margin-block: auto;
}

/* ---------- Header / nav ---------- */
/* Sticky lives on the custom element (a direct child of <body>) so it keeps
   sticking across the whole page. The inner .site-header only paints the bar. */
site-header {
  display: block;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Reserve the header's height before it's injected (see main.js) so nothing
   below it shifts on load. Matches the rendered bar: nav padding-block
   (2 × 1rem) + the 2rem toggle button + the 1px bottom border. The empty state
   also carries the bar's look so there is no flash of a blank strip. */
site-header:empty {
  min-height: calc(2rem + 2rem + 1px);
  border-bottom: 1px solid var(--border);
  background-color: color-mix(in srgb, var(--bg) 85%, transparent);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background-color: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
  flex-wrap: wrap;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  opacity: 0.7;
  line-height: 0;
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.nav__brand .logo {
  width: 26px;
  height: 26px;
  display: block;
  transition: transform 0.15s ease;
}

.nav__brand:hover {
  color: var(--accent);
  opacity: 1;
  text-decoration: none;
}

.nav__brand:hover .logo {
  transform: rotate(30deg);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 3vw, 1.6rem);
  list-style: none;
  padding: 0;
  flex-wrap: wrap;
}

.nav__links a {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.nav__links a:hover,
.nav__links a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

.nav__links a[aria-current="page"] {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 2px;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 1rem;
  height: 1rem;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

/* ---------- Hero (home) ---------- */
.hero {
  display: grid;
  gap: 2rem;
}

.hero__avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-accent);
}

.hero__head {
  display: grid;
  gap: 0.5rem;
}

.hero__name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero__tagline {
  color: var(--text-muted);
  font-size: 1.05rem;
  font-weight: 500;
}

.hero__bio {
  /* ~70-character measure for comfortable reading */
  max-width: 38rem;
  font-size: 1.125rem;
  color: var(--text-muted);
}

.hero__bio strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Actions ---------- */
.actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--text);
  color: var(--bg);
  /* Rule: horizontal padding is twice the vertical padding in buttons */
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 500;
  font-size: 0.98rem;
  text-decoration: none;
  transition: transform 0.15s ease, opacity 0.15s ease,
    background-color 0.3s ease, color 0.3s ease;
}

.btn:hover {
  text-decoration: none;
  color: var(--bg);
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn .arrow {
  /* Rule: lower the contrast of icons paired with text */
  opacity: 0.75;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover .arrow {
  opacity: 1;
  transform: translateX(3px);
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.98rem;
  text-decoration: none;
}

.link-arrow .arrow {
  transition: transform 0.15s ease;
}

.link-arrow:hover {
  color: var(--accent);
  text-decoration: none;
}

.link-arrow:hover .arrow {
  transform: translate(2px, -2px);
}

/* ---------- Responsive refinements ---------- */
@media (min-width: 60rem) {
  .hero {
    gap: 2.25rem;
  }

  .hero__avatar {
    width: 104px;
    height: 104px;
  }

  .hero__name {
    font-size: clamp(3rem, 3.6vw, 3.75rem);
  }

  .hero__bio {
    font-size: 1.2rem;
  }
}

@media (max-width: 24rem) {
  .nav__links {
    gap: 0.85rem;
  }

  .nav__links a {
    font-size: 0.9rem;
  }
}

/* ---------- Generic page content ---------- */
.page-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.page-lead {
  color: var(--text-muted);
  font-size: 1.15rem;
  margin-top: 0.75rem;
  max-width: 34rem;
}

.prose {
  margin-top: 2rem;
  display: grid;
  gap: 1.15rem;
  max-width: 100%;
}

.prose h2,
.prose h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 1rem;
}

.prose h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

.prose > :first-child {
  margin-top: 0;
}

.prose ul {
  padding-left: 1.2rem;
  display: grid;
  gap: 0.5rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

/* ---------- About sections ---------- */
.about-block {
  margin-top: 3rem;
}

.about-block__title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.about-block__title .duration {
  color: var(--accent);
}

.quick-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-4);
}

.quick-list li {
  position: relative;
  padding-left: 1.7rem;
  color: var(--text-muted);
}

.quick-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
}

.quick-list strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Contact list (hire-me) ---------- */
.contact-list {
  list-style: none;
  padding: 0;
  margin-top: 2rem;
  display: grid;
  gap: 0.85rem;
  max-width: 34rem;
}

.contact-list li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.contact-list .label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  width: 5.5rem;
  flex-shrink: 0;
}

/* ---------- Link arbor (elsewhere) ---------- */
.links-section {
  margin-top: 2.75rem;
}

.links-section__title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease,
    box-shadow 0.15s ease;
}

.link-row:hover {
  text-decoration: none;
  border-color: var(--accent);
  transform: translateY(-2px);
  /* blur (16) = 2 × distance (8); opacity drops as the card lifts closer */
  box-shadow: 0 8px 16px rgba(28, 26, 23, 0.08);
}

.link-row__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.link-row__label {
  color: var(--text);
  font-weight: 600;
}

.link-row__meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-row__arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.link-row:hover .link-row__arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* ---------- Trusted by (clients) ---------- */
.trust {
  margin-top: 3.5rem;
}

.trust__grid {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 34rem) {
  .trust__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.trust__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  padding: 1.25rem;
  background: var(--logo-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Normalise every logo to the same optical size so the wall looks uniform.
   Wide wordmarks sit at the base height; square/emblem/stacked marks are bumped
   up so they don't read as smaller at the same height. Width flexes; max-width
   keeps the very wide ones from touching the tile edges. */
.trust__item img {
  height: 30px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.trust__item[data-logo="mark"] img {
  height: 46px;
}

.trust__item[data-logo="mark-lg"] img {
  height: 52px;
}

/* ---------- Testimonials ---------- */
.testimonials {
  margin-top: 3.5rem;
}

.testimonials__grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.testimonial {
  margin: 0;
  padding: 1.5rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.testimonial blockquote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--text);
}

.testimonial blockquote::before {
  content: "\201C";
}

.testimonial blockquote::after {
  content: "\201D";
}

.testimonial figcaption {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.testimonial figcaption strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Placeholder note ---------- */
.placeholder {
  margin-top: 2.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
  font-size: 1rem;
  max-width: 34rem;
}

/* ---------- Back link ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Footer ---------- */
site-footer {
  display: block;
  flex-shrink: 0;
}

/* Reserve the footer's height before it's injected (see main.js) so the
   vertically-centered hero doesn't jump when the footer pops in. Matches the
   rendered footer: padding-block (2 × 1.75rem) + one line of text + border. */
site-footer:empty {
  min-height: calc(3.5rem + 0.9rem * 1.65 + 1px);
}

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

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

.footer-copy .copyleft {
  display: inline-block;
  transform: rotate(180deg);
}

/* ---------- Tooltip (info-bulle) ---------- */
.tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

.tooltip__bubble {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: min(22rem, 80vw);
  padding: 0.7rem 0.85rem;
  background: var(--text);
  color: var(--bg);
  border-radius: 10px;
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1.5;
  text-align: left;
  /* blur (16) = 2 × distance (8) */
  box-shadow: 0 8px 16px rgba(28, 26, 23, 0.16);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 20;
}

.tooltip__bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text);
}

.tooltip:hover .tooltip__bubble,
.tooltip:focus .tooltip__bubble,
.tooltip:focus-visible .tooltip__bubble {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
