/* Page CSS for luisandrade.me: only what sits inside a visual, plus the blog pages,
   which are not part of the kit. Tokens come from system.css. */

/* home: one panel height per card group */
#work .panel { --p-h: 340px; }
#writing .panel { --p-h: 220px; }
#work .ui-voice, #work .ui-chat { text-align: left; }
.post-card .panel > .frame__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* the process step's windows sit whole inside the lit frame */
#process .mo-pc__visual--lit > .ui { width: min(100%, 440px); }

/* ---------------------------------------------------------------- blog */
.page { padding-top: calc(var(--nav) + var(--s-8)); padding-bottom: var(--s-9); }
.page h1, .post h1 { font: var(--display-weight) var(--t-h2)/1.08 var(--font-display); letter-spacing: var(--display-tracking); margin: 0; }
.page__lead { font-size: var(--t-lead); line-height: 1.5; color: var(--ink); max-width: 56ch; margin: var(--s-4) 0 0; }

.blog-tools { display: grid; gap: var(--s-5); margin-block: var(--s-7) var(--s-8); }
.blog-search { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: end; }
.blog-search .field { flex: 1 1 280px; max-width: 480px; margin: 0; }
.blog-tags { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; margin: 0; padding: 0; }
.blog-tags a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s-4); border-radius: 999px;
  border: 1px solid var(--line); font-size: var(--t-small); font-weight: 500; color: var(--ink); text-decoration: none; }
.blog-tags a:hover { border-color: var(--line-strong, var(--ink)); }
.blog-tags a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.blog-count { color: var(--muted); font-size: var(--t-small); margin: 0 0 var(--s-5); }
.blog-grid { row-gap: var(--s-8); }
.blog-grid .panel { --p-h: 220px; }
.blog-empty { max-width: 56ch; }

.post { padding-top: calc(var(--nav) + var(--s-7)); padding-bottom: var(--s-9); }
.post__head { max-width: 760px; }
.post__back { display: inline-block; margin-bottom: var(--s-6); }
.post__tags { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-5); color: var(--muted); font-size: var(--t-label); font-weight: 500; }
.post__cover { margin: var(--s-7) 0 0; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16 / 9; max-width: 1040px; background: var(--g-alt, var(--surface)); }
.post__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* react-notion-x inside the site's type and colours */
.post .notion { --fg-color: var(--ink); --bg-color: transparent; font-family: var(--font-text); color: var(--ink); }
.post .notion-page { width: 100%; max-width: 760px; padding: 0; margin: var(--s-7) 0 0; }
.post .notion-text, .post .notion-list li { font-size: 18px; line-height: 1.7; }
.post .notion-h { font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: -0.02em; }
.post .notion-h1 { font-size: 32px; } .post .notion-h2 { font-size: 26px; } .post .notion-h3 { font-size: 21px; }
.post .notion-link { color: var(--action); border-bottom-color: currentColor; }
.post .notion-code { border-radius: var(--r-md); font-size: 14px; }
.post .notion-asset-wrapper img { border-radius: var(--r-md); }
.post .notion-title, .post .notion-page-icon-hero, .post .notion-page-cover-wrapper { display: none; }
@media (max-width: 639px) {
  .post .notion-text, .post .notion-list li { font-size: 17px; }
}

/* the brand's yellow is the flat ground every agent window stands on (panels, the hero frame, the
   process frame); kind other stays flat: no gradient, grain or effect */
:root { --ground-bg: var(--p-accent); --ground-surface: #ffe14d; --ground-ink: var(--p-ink); --ground-muted: #4a4000; --ground-accent: var(--p-ink); }
.hero__ui { background: var(--ground-bg); border-radius: var(--r-lg); overflow: hidden; }
.services__diagram { background: var(--g-alt, var(--p-surface)); border-radius: var(--r-lg); }

/* work: the calendar card shows the week's booked appointments, not the month grid */
#work .ui-calendar .ui-cal__dow, #work .ui-calendar .ui-cal__days { display: none; }
#work .ui-calendar .ui-cal__events { border-top: 0; }

/* hero: the chat is one whole window, its input showing, on the yellow */
.hero__chat { bottom: auto; }
.hero__chat > .ui-chat { height: auto; }

/* services: the diagram keeps its drawing room when the split stacks */
@media (min-width: 1024px) { .services__diagram { height: 100%; } }
/* the kit's focus ring inside Notion content, which resets outlines */
.post .notion :focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* the hero chat is a picture: its input reads as inert */
.hero__chat .ui-chat__input { opacity: 0.55; }

/* ---------------------------------------------------------------- split2
   Work, FAQ and writing hold their parts in two groups; from 1024px both dissolve into one 12-column grid. */
@media (min-width: 1024px) {
  main > section.section > .wrap.split2 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--card-gap); align-content: start; }
  .split2 > .split2__first, .split2 > .split2__rest { display: contents; }
  .split2 > *, .split2 > .split2__first > *, .split2 > .split2__rest > * { grid-column: 1 / -1; }
  #work .w-a { grid-column: 1 / 7; } #work .w-b { grid-column: 7 / -1; }
  #writing .post-card { grid-column: span 4; }
  main > #faq.section > .wrap.split2 { row-gap: 0; }
  #faq .faq-head { grid-column: 1 / 6; grid-row: 1 / span 2; }
  #faq .faq-a { grid-column: 7 / -1; grid-row: 1; } #faq .faq-b { grid-column: 7 / -1; grid-row: 2; }
  #faq .faq-b > .faq__item:first-child { padding-top: var(--s-5); }
}

/* ---------------------------------------------------------------- below 1024: content flow
   Phones, tablets and foldables (an open foldable is a near-square 700-900px screen) read one column
   down the page. Sections are as tall as their content, never a screen padded out or cut short, and
   every interface picture sits whole in its panel. */
@media (max-width: 1023px) {
  html[data-type] main > :is(section, .section):not(#process),
  html[data-type] main > .hero,
  html[data-type] footer.closing { height: auto; min-height: 0; display: block; }
  html[data-type] main > :is(section, .section):not(.hero, #process),
  html[data-type] footer.closing { padding: clamp(64px, 11vw, 96px) 0; }
  html[data-type] main > .hero { padding-bottom: clamp(56px, 10vw, 80px); }
  html[data-type] main > :is(section, .section) > .wrap,
  html[data-type] footer.closing > .wrap { height: auto; display: block; }
  html[data-type] main > :is(section, .section) > .wrap > * + *,
  html[data-type] footer.closing > .wrap > * + * { margin-top: var(--s-8); }

  /* hero: words, then the chat whole on the yellow */
  html[data-type] .hero > .wrap { display: block; }
  .hero--split .hero__grid { display: flex; flex-direction: column; }
  .hero--split .hero__media { flex: none; height: auto; min-height: 0; margin-top: var(--s-7); }
  .hero__text h1 { max-width: 18ch; }
  .hero__text .hero__lead { max-width: 60ch; }

  /* an interface on a panel is laid out in flow: the panel grows to it, nothing is cropped */
  .hero__ui > .stage, #work .panel > .stage { position: relative; inset: auto; -webkit-mask: none; mask: none; padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 40px); }
  .hero__ui > .stage > *, #work .panel > .stage > * { position: relative; inset: auto; width: 100%; max-width: var(--fit-max, 100%); margin-inline: auto; }
  .hero__ui > .stage > * > .ui, #work .panel > .stage > * > .ui { width: 100%; max-width: 100%; height: auto; }
  #work .panel { --p-h: 0px; min-height: 0; flex: none; margin-bottom: 0; border-radius: var(--r-lg); }

  /* services: the rows, then the diagram full width */
  #services .grid { display: block; }
  #services .services__diagram { height: clamp(340px, 62vw, 460px); min-height: 0; margin-top: var(--s-8); }
  #services .split-col__end { margin-top: var(--s-6); }

  /* work: the two cards side by side from 640px, stacked on a phone */
  #work .split2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-8); }
  #work .split2__first { display: grid; gap: var(--s-8); }
  #work .split2 > * + * { margin-top: 0; }
  #work .card { height: auto; }

  /* process at rest: each step's interface whole under its words */
  html[data-type] main > #process[data-moment]:not(.is-live) { height: auto; min-height: 0; padding: clamp(64px, 11vw, 96px) 0; }
  #process:not(.is-live) .mo-pc__visual--lit { aspect-ratio: auto; padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 40px); margin-top: var(--s-4); border-radius: var(--r-lg); }
  #process:not(.is-live) .mo-pc__visual--lit > .ui { width: min(100%, 480px); }
  #process:not(.is-live) .mo-pc__step { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-2); border-left: 0; border-top: 1px solid var(--line); padding: var(--s-6) 0 0; }
  #process:not(.is-live) .mo-pc__step > * { grid-column: 1; grid-row: auto; }
  #process .mo-pc__steps { gap: var(--s-8); }

  /* experience: the companies, then the tools */
  #experience .grid { display: block; }
  #experience .grid > * + * { margin-top: var(--s-8); }
  #experience .rows > li > p { grid-column: 1 / -1; }
  #experience .ic-grid--cols-3 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  /* faq: the heading, then every question */
  #faq .split2, #faq .split2__first { display: block; }
  #faq .faq-head { margin-bottom: var(--s-6); }
  #faq .faq-b > .faq__item:first-child { padding-top: var(--s-5); }

  /* writing: the heading, then the posts */
  #writing .split2 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-8); }
  #writing .split2__first, #writing .split2__rest { display: contents; }
  #writing .split2 > * + * { margin-top: 0; }
  #writing .section-head { grid-column: 1 / -1; }
  #writing .post-card { display: flex; flex-direction: column; }
  #writing .panel { --p-h: 0px; min-height: 0; flex: none; aspect-ratio: 16 / 10; margin-top: auto; padding-top: 0; border-radius: var(--r-lg); }
  #writing .post-card > p { margin-bottom: var(--s-5); }
  #faq .faq-b { margin-top: 0; }

  /* footer: the call, then the links */
  footer.closing .closing__links { margin-top: var(--s-9); }
}
@media (min-width: 640px) and (max-width: 1023px) {
  /* the two work cards keep a readable width: one under the other, each panel's window centred */
  #work .card { max-width: 640px; }
}
@media (max-width: 639px) {
  #writing .split2 { grid-template-columns: minmax(0, 1fr); }
  #experience .ic-grid--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #experience .ic-cell__meta { display: none; }
  #experience .ic-cell { padding: var(--s-4); }
  #experience .rows > li, #services .rows > li { padding-block: var(--s-3); }
  #services .rows__value { display: none; }
}

/* Desktop: a short window (a laptop, 1440x760) must not lay a section's last rows over the next one.
   The kit fixes each section at its screens from 1280 up; here it keeps them as a minimum and grows,
   as it already does from 640 to 1279. The pinned-chapters moment keeps its own height. */
@media (min-width: 1280px) {
  main > section.section:not(.hero, #process), footer.closing {
    height: auto; min-height: calc(var(--h, 1) * 100vh); min-height: calc(var(--h, 1) * 100svh);
    display: flex; flex-direction: column;
  }
  main > section.section:not(.hero, #process) > .wrap, footer.closing > .wrap { flex: 1 0 auto; height: auto; min-height: 0; }
}
