/* ==========================================================================
   Flávia Coelho — Portfólio
   Single stylesheet. Mobile-first. Edit the variables below to retheme.
   ========================================================================== */

/* --- Self-hosted fonts -----------------------------------------------------
   Drop the .woff2 files into /fonts/ (see /fonts/LEIA-ME.txt for where to get
   them). Until then, the fallback fonts below render automatically. */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-variable.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* --- Design tokens --------------------------------------------------------- */
:root {
  /* Colour */
  --paper:      #f7f5f1;   /* warm off-white background       */
  --paper-2:    #efece5;   /* subtle panel / card background  */
  --ink:        #1c1a17;   /* near-black text                 */
  --ink-soft:   #5b554d;   /* secondary text                  */
  --line:       #e3ded5;   /* hairline borders                */
  --accent:     #9c6b4a;   /* muted clay — links, hover       */
  --accent-dk:  #7c5238;

  /* Type */
  --font-serif: "Fraunces", "Georgia", "Times New Roman", serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Spacing / layout */
  --maxw: 1200px;
  --gutter: clamp(1.25rem, 5vw, 4rem);
  --space: clamp(4.5rem, 10vw, 9rem);  /* vertical rhythm between sections */
  --radius: 4px;

  /* Fluid type scale */
  --fs-hero:  clamp(2.75rem, 9vw, 6.5rem);
  --fs-h2:    clamp(2rem, 4.5vw, 3.5rem);
  --fs-h3:    clamp(1.15rem, 2vw, 1.4rem);
  --fs-body:  clamp(1rem, 1.1vw, 1.075rem);
  --fs-small: 0.85rem;

  color-scheme: light;
}

/* --- Dark theme -----------------------------------------------------------
   Redefine os mesmos tokens para o modo escuro. A terracota fica MAIS clara
   no escuro para manter contraste legível de links/eyebrows. */
[data-theme="dark"] {
  --paper:     #1b1815;   /* charcoal quente profundo */
  --paper-2:   #252019;   /* painéis / cards          */
  --ink:       #f0ece4;   /* texto off-white suave     */
  --ink-soft:  #b3aa9c;   /* texto secundário          */
  --line:      #3a342c;   /* fios / bordas             */
  --accent:    #c98a63;   /* preenchimentos / bordas   */
  --accent-dk: #d99e77;   /* texto de link / eyebrow   */

  color-scheme: dark;
}

/* --- Base ------------------------------------------------------------------ */
body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--paper);
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

section { padding-block: var(--space); }

.eyebrow {
  font-size: var(--fs-small);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dk);
  font-weight: 600;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.03em; line-height: 1.05; }
h3 { font-size: var(--fs-h3); letter-spacing: -0.01em; }

.lead { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--ink-soft); max-width: 60ch; }

/* --- Scroll-entry reveal ---------------------------------------------------
   Só age quando a classe .motion está no <html> (adicionada pelo script do
   <head> apenas se o usuário NÃO pediu "reduzir movimento"). Sem .motion,
   tudo aparece normalmente — nada fica escondido. */
.motion .reveal { opacity: 0; transform: translateY(12px); }
.motion .reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  left: 0; top: -100%;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  z-index: 1000;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* --- Buttons / links ------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.6em;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: var(--fs-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.25s, color 0.25s, transform 0.25s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { transform: scale(0.98); }
.btn--filled { background: var(--ink); color: var(--paper); }
.btn--filled:hover { background: var(--accent-dk); border-color: var(--accent-dk); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 600;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
  transition: gap 0.25s, color 0.25s;
}
.link-arrow:hover { color: var(--accent-dk); gap: 0.75em; }

/* --- Header / nav ---------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.5rem;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.brand span { color: var(--accent-dk); }

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}
.nav-toggle span {
  width: 26px; height: 2px;
  background: var(--ink);
  transition: transform 0.3s, opacity 0.3s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-menu {
  position: fixed;
  inset: 4.5rem 0 auto 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem var(--gutter) 2rem;
  transform: translateY(-120%);
  transition: transform 0.35s ease;
  box-shadow: 0 20px 40px -25px rgba(0,0,0,0.25);
}
.nav-menu.open { transform: translateY(0); }
.nav-menu a {
  padding: 0.85rem 0;
  font-size: 1.05rem;
  border-bottom: 1px solid var(--line);
}
.nav-menu a[aria-current="page"] { color: var(--accent-dk); font-weight: 600; }

@media (min-width: 760px) {
  .nav-toggle { display: none; }
  .nav-menu {
    position: static;
    transform: none;
    flex-direction: row;
    align-items: center;
    gap: 2rem;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: none;
  }
  .nav-menu a {
    padding: 0.25rem 0;
    font-size: var(--fs-small);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
    border: 0;
    position: relative;
  }
  .nav-menu a::after {
    content: "";
    position: absolute;
    left: 0; bottom: -4px;
    width: 0; height: 2px;
    background: var(--accent-dk);
    transition: width 0.25s;
  }
  .nav-menu a:hover::after,
  .nav-menu a[aria-current="page"]::after { width: 100%; }
}

/* --- Theme toggle ---------------------------------------------------------- */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  color: var(--ink);
  transition: background 0.2s, color 0.2s;
}
.theme-toggle:hover { background: var(--paper-2); color: var(--accent-dk); }
.theme-toggle svg { width: 20px; height: 20px; }
/* Mostra a lua no claro (clique p/ escurecer) e o sol no escuro. */
.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 ------------------------------------------------------------------ */
.hero { padding-block: clamp(5rem, 13vw, 11rem); }
.hero .eyebrow { margin-bottom: 1.25rem; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: var(--fs-hero);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.98;
}
.hero h1 em { font-style: italic; color: var(--accent-dk); }
.hero .lead { margin-top: 1.75rem; }
.hero .cta-row { margin-top: 2.5rem; display: flex; flex-wrap: wrap; gap: 1rem; }

/* Hero com retrato — mobile: texto primeiro, foto abaixo */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 6vw, 4rem);
  align-items: center;
}
.hero-portrait {
  max-width: 360px;
  margin-inline: auto;
}
/* Borda esfumada (vinheta) via máscara: dissolve na cor do fundo, em
   QUALQUER tema (claro/escuro) — sem branco "pintado", sem sombra/borda. */
.hero-portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;          /* reserva a caixa: zero layout shift */
  object-fit: cover;
  -webkit-mask-image: radial-gradient(circle at 50% 46%, #000 52%, transparent 80%);
          mask-image: radial-gradient(circle at 50% 46%, #000 52%, transparent 80%);
}

/* Desktop: texto à esquerda, retrato à direita */
@media (min-width: 820px) {
  .hero-grid { grid-template-columns: 1fr 0.85fr; }
  .hero-portrait { max-width: 460px; margin-inline: 0; justify-self: end; }
}

/* --- Section heading row --------------------------------------------------- */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}
.section-head .eyebrow { display: block; margin-bottom: 0.75rem; }

/* --- Work grid (homepage featured + gallery) ------------------------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1rem, 3vw, 2rem);
}
@media (min-width: 560px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  display: block;
  background: var(--paper-2);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.4s ease;
}
.card:hover img, .card:focus-visible img { transform: scale(1.03); }

.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.1rem;
  background: linear-gradient(to top, rgba(20,18,15,0.72) 0%, rgba(20,18,15,0) 55%);
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.card:hover .card-overlay,
.card:focus-visible .card-overlay { opacity: 1; }
.card-overlay .c-title { font-family: var(--font-serif); font-size: 1.1rem; }
.card-overlay .c-cat {
  font-size: var(--fs-small);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* --- Filter bar ------------------------------------------------------------ */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}
.filter-btn {
  padding: 0.55em 1.1em;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: var(--fs-small);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--ink); color: var(--ink); }
.filter-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-soft);
  padding: 3rem 0;
}

/* Card enter animation when (re)filtered */
.card.is-enter { animation: fade-up 0.45s ease both; }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Lightbox -------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(18,16,14,0.92);
}
.lightbox.open { display: flex; }
.lb-figure {
  margin: 0;
  max-width: min(92vw, 1000px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.lb-figure img {
  max-height: 78vh;
  width: auto;
  margin-inline: auto;
  border-radius: var(--radius);
  background: var(--paper-2);
}
.lb-caption { color: #f3f0ea; text-align: center; }
.lb-caption .lb-title { font-family: var(--font-serif); font-size: 1.2rem; }
.lb-caption .lb-meta { font-size: var(--fs-small); opacity: 0.75; letter-spacing: 0.05em; }

.lb-btn {
  position: absolute;
  color: #fff;
  width: 3rem; height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.6rem;
  background: rgba(255,255,255,0.08);
  transition: background 0.2s;
}
.lb-btn:hover { background: rgba(255,255,255,0.2); }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev  { left: 0.5rem;  top: 50%; transform: translateY(-50%); }
.lb-next  { right: 0.5rem; top: 50%; transform: translateY(-50%); }
@media (min-width: 760px) { .lb-prev { left: 1.5rem; } .lb-next { right: 1.5rem; } }

/* --- About ----------------------------------------------------------------- */
.about-grid {
  display: grid;
  gap: clamp(2rem, 6vw, 4rem);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 820px) {
  .about-grid { grid-template-columns: 0.85fr 1.15fr; }
}
.about-portrait {
  aspect-ratio: 3 / 4;
  background: var(--paper-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.about-portrait img { width: 100%; height: 100%; object-fit: cover; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-bottom: 0.5em; }

.facts {
  margin-top: 2.5rem;
  display: grid;
  gap: 1.5rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}
.facts dt { font-size: var(--fs-small); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-dk); margin-bottom: 0.35rem; }
.facts dd { color: var(--ink-soft); }

/* --- Contact --------------------------------------------------------------- */
.contact-grid {
  display: grid;
  gap: clamp(2rem, 6vw, 4rem);
  grid-template-columns: 1fr;
}
@media (min-width: 820px) { .contact-grid { grid-template-columns: 1fr 1fr; } }

.form-field { margin-bottom: 1.25rem; }
.form-field label {
  display: block;
  font-size: var(--fs-small);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.form-field input:focus,
.form-field textarea:focus { border-color: var(--accent); outline: none; }
.form-field textarea { resize: vertical; min-height: 140px; }

.contact-meta a { color: var(--accent-dk); border-bottom: 1px solid currentColor; }
.contact-meta li + li { margin-top: 1rem; }

/* --- Footer ---------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 3rem;
  margin-top: var(--space);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  justify-content: space-between;
}
.footer-inner .brand { font-size: 1.15rem; }
.footer-social { display: flex; gap: 1.25rem; }
.footer-social a { font-size: var(--fs-small); letter-spacing: 0.05em; color: var(--ink-soft); }
.footer-social a:hover { color: var(--accent-dk); }
.copyright { width: 100%; font-size: var(--fs-small); color: var(--ink-soft); margin-top: 1.5rem; }
