/* ============================================================
   Carlos Lastres — carloslastres.jp
   Implementation of "Carlos - Palantir Style v2"
   ============================================================ */

:root {
  --bg:        #000;
  --fg:        #f2f2f0;
  --line:      #26262a;   /* hairline on dark   */
  --dim:       #8b8b90;   /* muted text on dark */
  --hover:     #0d0d10;   /* row/card hover     */

  --bg-light:  #fafafa;
  --fg-light:  #111114;
  --lline:     #e2e2e0;   /* hairline on light   */
  --ldim:      #6f6f74;   /* muted text on light */
  --body-light:#3c3c40;
  --body-mute: #55555a;

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --photo-filter: grayscale(1) contrast(1.05);

  --gutter: 56px;
  --pad-y: 110px;
  --label-col: 220px;
  --gap: 60px;
  --ease: 140ms ease;
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Libre Franklin', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; transition: opacity var(--ease), background-color var(--ease), border-color var(--ease), color var(--ease); }
a:hover { opacity: .7; }

img { max-width: 100%; height: auto; }
h1, h2, h3 { font-weight: 300; letter-spacing: -.015em; margin: 0; }
h1 strong, h2 strong { font-weight: 600; }
p { margin: 0; }

::selection { background: #fff; color: #000; }

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* Sticky header offset for in-page anchors */
section[id] { scroll-margin-top: 84px; }

/* ── Motion layer ─────────────────────────────────────────
   Everything here is additive. Without the .js class (script
   disabled, or app.js failed to boot) all of it is inert and
   the page renders exactly as it did before. */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--fg);
  color: #000;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
  opacity: 1;
}

/* Reveal on scroll */
/* No will-change here on purpose. There are ~75 of these on the page and
   promoting them all would hold ~75 compositor layers for the whole visit,
   which costs far more on a mid-range phone than it saves. */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
}
.js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  transition: opacity 620ms var(--ease-smooth), transform 620ms var(--ease-smooth);
  will-change: auto;
}
/* Belt and braces: if someone asks for reduced motion, the copy is
   visible from CSS alone and never depends on a script running. */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; }
  .ascii-field, .cursor, .scroll-progress { display: none; }
}

/* ASCII sphere behind the hero copy */
.ascii-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 1200ms ease;
  /* Fades out toward the edges so it reads as atmosphere, not a widget.
     Centre matches the sphere centre in app.js (60% / 66%). */
  -webkit-mask-image: radial-gradient(ellipse 34% 42% at 60% 66%, #000 42%, transparent 88%);
          mask-image: radial-gradient(ellipse 34% 42% at 60% 66%, #000 42%, transparent 88%);
}
.ascii-field.is-live { opacity: 1; }
/* Below 1000px the hero stacks, so there is no open space to park the
   sphere in and it would sit under the copy. Not worth the battery. */
@media (max-width: 1000px) { .ascii-field { display: none; } }

/* Lagging crosshair. The native cursor stays visible on purpose;
   losing it is a usability tax this design does not need to pay. */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 26px;
  height: 26px;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: difference;
  transition: opacity 300ms ease, width 220ms var(--ease-smooth), height 220ms var(--ease-smooth);
}
.has-cursor .cursor { opacity: .55; }
.cursor::before,
.cursor::after {
  content: "";
  position: absolute;
  background: #fff;
}
.cursor::before { left: 50%; top: 0; width: 1px; height: 100%; transform: translateX(-50%); }
.cursor::after  { top: 50%; left: 0; height: 1px; width: 100%; transform: translateY(-50%); }
.cursor.is-hot { width: 42px; height: 42px; }

/* Scroll progress hairline under the masthead */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: 0 50%;
  z-index: 60;
  pointer-events: none;
}

.stars { letter-spacing: .06em; }

/* ── Masthead ─────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, .94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.brand { font-weight: 600; font-size: 15px; letter-spacing: .14em; }

.masthead-nav {
  display: flex;
  gap: 34px;
  font-size: 12px;
  letter-spacing: .18em;
  font-weight: 500;
}

.btn-outline-mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  border: 1px solid var(--fg);
  padding: 10px 22px;
  white-space: nowrap;
}
.btn-outline-mono:hover { background: var(--fg); color: #000; opacity: 1; }

/* ── Shared section furniture ─────────────────────────── */

.panel-dark,
.panel-light {
  padding: var(--pad-y) var(--gutter);
}
.panel-dark  { border-bottom: 1px solid var(--line); }
.panel-light { background: var(--bg-light); color: var(--fg-light); border-bottom: 1px solid var(--lline); }

.split { display: grid; grid-template-columns: var(--label-col) 1fr; gap: var(--gap); }
.split-head { margin-bottom: 70px; align-items: start; }

.section-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
}
.panel-dark .section-label, .hero .section-label, .ada .section-label { color: var(--dim); }
.panel-light .section-label { color: var(--ldim); }

.display { font-size: clamp(32px, 5vw, 54px); }

.micro-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  margin: 56px 0 20px;
}
.panel-light .micro-label { color: var(--ldim); }
.panel-dark  .micro-label { color: var(--dim); }
.micro-label-dark { margin: 0 0 20px; }

/* Hairline grids: 1px gap over a background produces the rules */
.grid-3, .grid-2 { display: grid; gap: 1px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.hairline       { background: var(--line);  border: 1px solid var(--line); }
.hairline-light { background: var(--lline); border: 1px solid var(--lline); }

/* ── Buttons ──────────────────────────────────────────── */

.btn-solid {
  background: var(--fg);
  color: #000;
  padding: 15px 34px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .04em;
}
.btn-solid:hover { opacity: .85; }

.btn-outline {
  border: 1px solid var(--line);
  padding: 15px 34px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .04em;
}
.btn-outline:hover { border-color: var(--fg); opacity: 1; }

.btn-solid-dark {
  display: inline-block;
  background: var(--fg-light);
  color: var(--bg-light);
  padding: 18px 44px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
}
.btn-solid-dark:hover { opacity: .85; }

/* ── Hero ─────────────────────────────────────────────── */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 80px;
  align-items: center;
  padding: 120px var(--gutter) 100px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero-body, .hero-figure { position: relative; z-index: 1; }

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
  letter-spacing: .08em;
  margin-bottom: 36px;
}

.hero h1 { font-size: clamp(40px, 4.8vw, 74px); line-height: 1.08; }

.hero-lede {
  max-width: 560px;
  font-size: 18px;
  line-height: 1.7;
  color: #c9c9cd;
  margin-top: 36px;
  font-weight: 300;
}

/* Monospaced spec sheet with dot leaders */
.spec-list {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--dim);
  border-left: 1px solid var(--line);
  padding-left: 28px;
  margin: 44px 0 0;
  max-width: 430px;
}
.spec-list > div { display: flex; align-items: baseline; line-height: 2.1; }
.spec-list dt { display: flex; align-items: baseline; flex: 1; white-space: nowrap; }
.spec-list dt::after {
  content: "";
  flex: 1;
  margin: 0 .7ch;
  border-bottom: 1px dotted var(--dim);
  opacity: .5;
  position: relative;
  top: -.28em;
}
.spec-list dd { margin: 0; white-space: nowrap; }

.cta-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 48px; }

.hero-figure { margin: 0; }
.hero-figure img {
  width: 100%;
  display: block;
  filter: var(--photo-filter);
  border: 1px solid var(--line);
}
.hero-figure figcaption {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

/* ── About ────────────────────────────────────────────── */

.prose { max-width: 820px; }
.prose h2 { font-size: clamp(28px, 4vw, 44px); line-height: 1.2; margin-bottom: 40px; }
.prose p {
  font-size: 17px;
  line-height: 1.8;
  font-weight: 300;
  color: var(--body-light);
  margin-bottom: 24px;
}
.prose p:last-of-type { margin-bottom: 0; }

.logo-wall {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 28px 44px;
  align-items: center;
}
/* Optical sizing: each mark is balanced by eye, not by a shared height */
.logo-wall img { display: block; width: auto; }
.logo-tedx      { height: 26px; }
.logo-speechify { height: 24px; }
.logo-hp        { height: 36px; }
.logo-toei      { height: 40px; }
.logo-microsoft { height: 24px; }
.logo-sylvanian { height: 30px; }
.logo-cryptokitties { height: 28px; }
.logo-peaq      { height: 26px; }
.logo-compound  { height: 26px; }
.logo-web3auth  { height: 24px; }
.logo-sahara    { height: 20px; }

/* ── Apple Design Award ───────────────────────────────── */

.ada {
  display: grid;
  grid-template-columns: var(--label-col) 1fr 320px;
  gap: var(--gap);
  align-items: center;
  padding: var(--pad-y) var(--gutter);
  border-bottom: 1px solid var(--line);
}
.ada h2 { font-size: clamp(28px, 4vw, 44px); line-height: 1.25; margin-bottom: 20px; }
.mono-note { font-family: var(--mono); font-size: 13px; color: var(--dim); line-height: 1.8; }
.ada-trophy { width: 100%; display: block; }

/* ── App cards ────────────────────────────────────────── */

.app-card {
  background: var(--bg);
  padding: 44px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.app-card:hover { background: var(--hover); opacity: 1; }

.tag { font-family: var(--mono); font-size: 11px; color: var(--dim); letter-spacing: .14em; }
.app-name { font-size: 26px; font-weight: 500; }
.app-desc { color: #a9a9ae; font-size: 14px; line-height: 1.7; font-weight: 300; flex: 1; }
.card-foot {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

/* ── Capabilities ─────────────────────────────────────── */

.cap-list { display: flex; flex-direction: column; border-top: 1px solid var(--lline); }
.cap-row {
  display: grid;
  grid-template-columns: var(--label-col) 320px 1fr;
  gap: var(--gap);
  padding: 36px 0;
  border-bottom: 1px solid var(--lline);
  align-items: start;
}
.cap-num { font-family: var(--mono); font-size: 12px; color: var(--ldim); }
.cap-row h3 { font-size: 22px; font-weight: 500; letter-spacing: 0; }
.cap-row p { color: var(--body-mute); font-size: 15px; line-height: 1.7; font-weight: 300; }

/* ── Selected work ────────────────────────────────────── */

.work-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); font-size: 15px; }
.work-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr 60px;
  gap: 24px;
  align-items: baseline;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.work-row:hover { background: var(--hover); opacity: 1; }
.work-id    { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.work-name  { font-size: 19px; font-weight: 500; }
.work-scope { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.work-arrow { font-family: var(--mono); color: var(--dim); }

/* ── Impact stats ─────────────────────────────────────── */

.stat { background: var(--bg-light); padding: 44px; }
.stat-figure { font-family: var(--mono); font-size: clamp(34px, 3.5vw, 44px); font-weight: 500; }
.stat-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ldim);
  letter-spacing: .14em;
  margin: 14px 0 18px;
}
.stat p:last-child { color: var(--body-mute); font-size: 14px; line-height: 1.7; font-weight: 300; }

/* ── Speaking ─────────────────────────────────────────── */

.talk-card { background: var(--bg); display: flex; flex-direction: column; }
.talk-card:hover { background: var(--hover); opacity: 1; }
.talk-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  filter: var(--photo-filter);
}
.talk-body { padding: 28px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.talk-name { font-size: 20px; font-weight: 500; }
.talk-body .card-foot { border-top: none; margin-top: auto; padding-top: 14px; letter-spacing: 0; }

.un-banner {
  border: 1px solid var(--line);
  background: var(--bg-light);
  color: var(--fg-light);
  padding: 44px 48px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 40px;
  margin: 1px 0 70px;
}
.un-banner .micro-label { color: var(--ldim); margin: 0 0 10px; }
.un-headline { font-size: clamp(22px, 2.6vw, 30px); font-weight: 300; }
.un-headline strong { font-weight: 600; }
.un-meta { font-family: var(--mono); font-size: 12px; color: var(--ldim); white-space: nowrap; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; }

.link-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.link-list a {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 400;
}
.arrow { font-family: var(--mono); color: var(--dim); }

/* ── Testimonials ─────────────────────────────────────── */

.quote { background: var(--bg-light); padding: 44px; margin: 0; }
.quote blockquote {
  font-size: 17px;
  line-height: 1.7;
  font-weight: 300;
  margin: 0 0 26px;
  color: var(--body-light);
}
.quote figcaption { font-family: var(--mono); font-size: 12px; color: var(--ldim); }

/* ── Writing ──────────────────────────────────────────── */

.writing-head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; }
.all-posts { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--dim); white-space: nowrap; }

.post-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.post-row {
  display: grid;
  grid-template-columns: var(--label-col) 1fr;
  gap: var(--gap);
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.post-row:hover { background: var(--hover); opacity: 1; }
.post-cat   { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.post-title { font-size: 17px; font-weight: 400; }

/* ── Contact ──────────────────────────────────────────── */

.contact { padding: 150px var(--gutter); }
.contact .section-label { margin-bottom: 32px; }
.contact-headline { font-size: clamp(40px, 5vw, 76px); line-height: 1.1; margin-bottom: 28px; }
.contact-sub { font-size: 17px; color: var(--body-mute); font-weight: 300; margin-bottom: 48px; max-width: 640px; }

/* ── Footer ───────────────────────────────────────────── */

.site-footer {
  padding: 36px var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px 32px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--dim);
  letter-spacing: .06em;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 24px; }

/* ============================================================
   Responsive — the source design was fixed at min-width 1100px
   ============================================================ */

@media (max-width: 1180px) {
  :root { --gutter: 40px; --gap: 44px; --label-col: 180px; --pad-y: 90px; }
  .hero { grid-template-columns: 1fr 320px; gap: 56px; }
  .two-col { gap: 56px; }
}

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; gap: 56px; padding-top: 88px; }
  .hero-figure { max-width: 380px; }
  .ada { grid-template-columns: 1fr; gap: 36px; }
  .ada-trophy { max-width: 320px; }
}

@media (max-width: 900px) {
  .masthead-nav { display: none; }
  .split { grid-template-columns: 1fr; gap: 20px; }
  .split-head { margin-bottom: 48px; }
  .cap-row { grid-template-columns: 1fr; gap: 12px; }
  .two-col { grid-template-columns: 1fr; gap: 48px; }
  .un-banner { flex-direction: column; align-items: flex-start; gap: 24px; }
  .un-meta { white-space: normal; }
}

@media (max-width: 880px) {
  .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --gutter: 22px; --pad-y: 72px; }
  .grid-2 { grid-template-columns: 1fr; }
  /* id + name + arrow on one line, scope wrapping beneath the name */
  .work-row { grid-template-columns: 56px 1fr auto; gap: 5px 12px; align-items: baseline; }
  .work-id    { grid-area: 1 / 1; }
  .work-name  { grid-area: 1 / 2; }
  .work-arrow { grid-area: 1 / 3; }
  .work-scope { grid-area: 2 / 2 / 3 / 4; font-size: 11px; }
  .post-row { grid-template-columns: 1fr; gap: 6px; }
  .app-card, .quote, .stat { padding: 32px; }
  .un-banner { padding: 32px; }
  .contact { padding: 96px var(--gutter); }
  .writing-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .hero { padding-top: 64px; padding-bottom: 72px; }
  .site-footer { flex-direction: column; align-items: flex-start; }
}

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