/* Nicolás Cruz Alayza — personal site
   Editorial cálido · indie-web spirit, editorial finish */

:root {
  --paper:      #f4efe4;   /* cream */
  --paper-2:    #ece5d6;   /* slightly deeper cream for hairlines/wells */
  --ink:        #1f1a15;   /* warm near-black */
  --ink-soft:   #4a4239;   /* body text */
  --muted:      #8a7f70;   /* secondary / dates */
  --accent:     #b4542a;   /* terracotta / oxide */
  --accent-dim: #c98a64;   /* hover / soft accent */
  --rule:       #ddd3c0;

  --measure: 36rem;        /* comfortable reading width */
  --serifish: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system,
              "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--serifish);
  font-size: 18px;
  line-height: 1.65;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: multiply;
  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.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
  position: relative;
  z-index: 2;
  max-width: 42rem;
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 7rem) 1.5rem 4rem;
}

/* ---------- HERO ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  margin-bottom: 3.25rem;
}
.hero-text { min-width: 0; }

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.04;
  letter-spacing: -0.022em;
  font-weight: 600;
  color: var(--ink);
}

.role {
  margin: 0.7rem 0 0;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 500;
}
.role .dot { color: var(--accent); margin: 0 0.5em; font-weight: 700; }

/* portrait — warm duotone via filter */
.portrait {
  display: block;
  border-radius: 14px;
  object-fit: cover;
  filter: grayscale(100%) sepia(22%) contrast(104%) brightness(102%);
  transition: filter 0.5s ease;
  background: var(--paper-2);
}
.portrait:hover { filter: grayscale(0%) sepia(0%) contrast(100%); }

.portrait--hero {
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
  box-shadow: 0 1px 0 var(--rule), 0 14px 30px -18px rgba(60, 40, 20, 0.5);
}

/* ---------- ABOUT ---------- */
.about p {
  margin: 0 0 1.15rem;
  max-width: var(--measure);
}
.about p.lead {
  font-size: 1.22rem;
  line-height: 1.5;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.cta { margin-top: 1.6rem !important; }

/* ---------- SECTIONS ---------- */
.section {
  margin-top: 3.25rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 1.4rem;
}

/* ---------- SELECTED WORK ---------- */
.work-item { margin-bottom: 1.9rem; max-width: var(--measure); }
.work-item:last-child { margin-bottom: 0; }
.work-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}
.work-head .title { color: var(--ink); font-weight: 600; }
.work-head .place {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}
.work-item p {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.98rem;
  line-height: 1.55;
}
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tags span {
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.12rem 0.62rem;
  white-space: nowrap;
}
.also {
  margin: 1.6rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: var(--measure);
}

/* ---------- BACKGROUND ---------- */
.role-group { margin-bottom: 1.4rem; }
.role-group .group-org { color: var(--ink); font-weight: 600; margin-bottom: 0.55rem; }
.role-group .entry { margin-bottom: 0.45rem; }
.role-group .entry:last-child { margin-bottom: 0; }
.role-group .entry .what { color: var(--ink-soft); }

.entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  margin-bottom: 1.1rem;
}
.entry:last-child { margin-bottom: 0; }
.entry .what { color: var(--ink); }
.entry .what .org { color: var(--ink); font-weight: 600; }
.entry .what .meta { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 0.1rem; }
.entry .when {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- CONTACT ---------- */
.contact a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.contact a:hover { color: var(--accent); border-color: var(--accent-dim); }
.contact .row { margin-bottom: 0.6rem; }
.contact .row:last-child { margin-bottom: 0; }

a { color: var(--accent); }

/* ---------- FOOTER + MONOGRAM ---------- */
.mono-mark {
  display: inline-grid;
  place-items: center;
  width: 1.7rem; height: 1.7rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--paper);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: -0.5px;
  flex: 0 0 auto;
}
.footer {
  margin-top: 3.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ================= RAIL LAYOUT (demo) ================= */
.layout-rail .wrap {
  max-width: 54rem;
  display: grid;
  grid-template-columns: 12.5rem 1fr;
  gap: 3.25rem;
  align-items: start;
  padding-top: clamp(3rem, 7vw, 5.5rem);
}
.rail {
  position: sticky;
  top: clamp(3rem, 7vw, 5.5rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.rail .portrait { width: 84px; height: 84px; border-radius: 12px; }
.rail .r-name {
  font-weight: 600; color: var(--ink);
  font-size: 1.1rem; line-height: 1.2; letter-spacing: -0.01em;
}
.rail .r-role { color: var(--muted); font-size: 0.84rem; margin-top: 0.25rem; }
.rail nav { display: flex; flex-direction: column; gap: 0.5rem; }
.rail nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.95rem;
  width: fit-content;
  border-bottom: 1.5px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.rail nav a:hover { color: var(--accent); border-color: var(--accent-dim); }
.rail .r-contact { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; padding-top: 0.4rem; }
.rail .r-contact a { color: var(--muted); text-decoration: none; }
.rail .r-contact a:hover { color: var(--accent); }
.layout-rail .main > .section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

@media (max-width: 760px) {
  .layout-rail .wrap { grid-template-columns: 1fr; gap: 2.25rem; }
  .rail { position: static; }
  .rail nav { flex-direction: row; flex-wrap: wrap; gap: 0.4rem 1.1rem; }
}

@media (max-width: 480px) {
  body { font-size: 17px; }
  .hero { gap: 1.25rem; }
  .portrait--hero { width: 96px; height: 96px; }
  .entry, .work-head { flex-direction: column; gap: 0.15rem; }
}
