/* ============================================================
   Saidh J. Fuentes — personal site
   Shared styles. Content panels are white; page bg is dark.
   Theme values come in as CSS vars (see theme.js / Tweaks).
   ============================================================ */

:root {
  /* Defaults — overridden at runtime by theme.js from localStorage/Tweaks */
  --bg: #15171c;
  --panel: #ffffff;
  --ink: #16161a;
  --muted: #8b8d96;
  --hair: #ececec;
  --accent: #3c8f8f;
  --font-display: "Archivo", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --name-transform: uppercase;
  --name-spacing: 0.04em;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 44px;
  transition: background-color .35s ease;
}

/* very subtle paper grain on the dark field, like the references */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- frame: two white panels ---------- */
.frame {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1320px;
  margin: auto;
  display: flex;
  gap: 26px;
  align-items: stretch;
  /* Fixed frame: panels keep the same size on every page. */
  height: clamp(560px, calc(100vh - 88px), 900px);
}

/* ---------- sidebar ---------- */
.sidebar {
  width: 358px;
  flex-shrink: 0;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 64px 36px 48px;
}

.avatar {
  width: 152px;
  height: 152px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 56% 44%;
  background: #e9ecef;
  filter: grayscale(1) contrast(1.02);
  transition: filter .4s ease, transform .4s ease;
}
.avatar:hover { filter: grayscale(0) contrast(1); transform: scale(1.02); }

.nav {
  margin-top: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 17px;
}
.nav a {
  font-size: 17px;
  letter-spacing: .01em;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s ease;
}
.nav a:hover { color: var(--ink); }
.nav a.active { color: var(--ink); font-weight: 600; }

.sidebar-foot {
  margin-top: auto;
  padding-top: 56px;
  text-align: center;
}
.copyright {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
  margin: 0 0 22px;
}
.copyright strong { color: var(--ink); font-weight: 600; }

/* ---------- social row ---------- */
.social {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
.social a {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--muted);
  transition: background-color .22s ease, transform .22s ease;
}
.social a:hover { background: var(--accent); transform: translateY(-2px); }
.social svg { width: 16px; height: 16px; fill: currentColor; display: block; }

/* ---------- content panel ---------- */
.content {
  flex: 1;
  background: var(--panel);
  padding: 60px 68px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

/* HOME — centered hero */
.content.home {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.hero-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 3.8vw, 54px);
  letter-spacing: var(--name-spacing);
  text-transform: var(--name-transform);
  line-height: 1.02;
  margin: 0;
  font-stretch: 125%;
}
.hero-sub {
  font-size: 19px;
  color: var(--muted);
  letter-spacing: .02em;
  margin: 22px 0 0;
}
.hero-social {
  margin-top: 38px;
  display: flex;
  gap: 14px;
  justify-content: center;
}
.hero-social a {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--hair);
  color: var(--muted);
  transition: color .22s ease, border-color .22s ease, transform .22s ease;
}
.hero-social a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.hero-social svg { width: 18px; height: 18px; fill: currentColor; display: block; }

/* ---------- section heading w/ pill (gallery + contact) ---------- */
.section {
  border: 1px solid var(--hair);
  padding: 44px 44px 50px;
  position: relative;
}
.pill {
  position: absolute;
  top: -17px;
  left: 34px;
  background: #f3f3f3;
  padding: 9px 20px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* GALLERY grid */
.gallery-intro {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  margin: 6px 0 30px;
  max-width: 60ch;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.gallery-grid image-slot {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  min-height: 200px;
}
.gallery-grid image-slot::part(frame) { background: #f1f2f4; }
@media (max-width: 1180px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* CONTACT */
.contact-lead {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.75;
  margin: 6px 0 28px;
  max-width: 56ch;
}
.contact-email {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 34px;
  text-decoration: none;
}
.contact-email .label {
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.contact-email .addr {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(20px, 2.4vw, 30px);
  color: var(--ink);
  letter-spacing: .005em;
  border-bottom: 2px solid transparent;
  transition: border-color .22s ease, color .22s ease;
}
.contact-email:hover .addr { border-color: var(--accent); color: var(--accent); }

.form { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; }
.field label {
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.field input,
.field textarea {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  border: 1px solid var(--hair);
  background: #fff;
  padding: 14px 16px;
  outline: none;
  transition: border-color .2s ease;
  border-radius: 0;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus,
.field textarea:focus { border-color: var(--accent); }

.btn {
  justify-self: start;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 14px;
  color: #fff;
  background: var(--ink);
  border: none;
  padding: 15px 34px;
  cursor: pointer;
  transition: background-color .22s ease, transform .12s ease;
}
.btn:hover { background: var(--accent); }
.btn:active { transform: translateY(1px); }

.form-note {
  font-size: 14px;
  color: var(--accent);
  margin: 4px 0 0;
  min-height: 18px;
}

/* ---------- PROJECTS ---------- */
.projects-intro {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  margin: 6px 0 28px;
  max-width: 60ch;
}
.projects-list { display: grid; gap: 16px; }
.project-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 24px 26px;
  border: 1px solid var(--hair);
  text-decoration: none;
  color: var(--ink);
  transition: border-color .22s ease, transform .22s ease, box-shadow .22s ease;
}
.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .35);
}
.project-icon {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 12px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: #f1f2f4;
  border: 1px solid var(--hair);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .02em;
  color: var(--muted);
  overflow: hidden;
}
.project-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}
.project-meta { flex: 1; min-width: 0; }
.project-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: .005em;
  margin: 0;
}
.project-url {
  font-size: 14px;
  color: var(--muted);
  margin: 5px 0 0;
  font-family: var(--font-body);
}
.project-arrow {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--muted);
  transition: color .22s ease, transform .22s ease;
}
.project-card:hover .project-arrow { color: var(--accent); transform: translate(3px, -3px); }
.project-arrow svg { width: 100%; height: 100%; display: block; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  body { padding: 18px; align-items: flex-start; }
  .frame { flex-direction: column; gap: 18px; height: auto; }
  .sidebar { width: 100%; padding: 44px 28px 36px; }
  .content { overflow-y: visible; }
  .nav { margin-top: 40px; }
  .sidebar-foot { padding-top: 44px; }
  .content { padding: 44px 30px; }
  .content.home { min-height: 52vh; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 540px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

/* mount point for the React Tweaks panel — never blocks layout */
#tweaks-root { position: fixed; z-index: 9999; }
