/* Carlo Dorian Ducartis — Founder Site v1 (polish pass 1)
   Mobile-first. System fonts only. No third-party requests. */

:root {
  /* Cool graphite base rather than pure black. */
  --ink: #0b0c0e;
  --ink-deep: #08090b;
  --graphite: #13161a;
  --graphite-soft: #101216;

  --stone: #dfdad2;
  --stone-soft: #cdc8c0;
  --steel: #b3b7bb;
  --steel-dim: #999da2;
  --bright: #f1ede6;

  /* The warm light of the master visual. Used sparingly. */
  --horizon: #d9a066;
  --horizon-rgb: 217, 160, 102;

  --line: rgba(220, 215, 206, 0.13);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", P052, Georgia, serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --measure: 76rem;
  /* Horizontal padding that keeps content at --measure while backgrounds run full width. */
  --inline: max(var(--gutter), calc((100% - var(--measure)) / 2 + var(--gutter)));
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--stone);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--horizon);
  outline-offset: 4px;
  border-radius: 1px;
}

main:focus {
  outline: none;
}

::selection {
  background: rgba(var(--horizon-rgb), 0.35);
  color: #fff;
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--stone);
  color: var(--ink);
  font-size: 0.875rem;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--gutter);
  padding-bottom: clamp(3rem, 9vh, 6rem);
  overflow: hidden;
  background: var(--ink);
}

.hero__media,
.hero__media img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
}

.hero__media img {
  object-fit: cover;
  object-position: 50% 45%;
  /* A small lift; no recolouring. */
  filter: brightness(1.06) contrast(1.03);
}

/* Warm light layer: strengthens the seam and horizon that already exist in
   the image. Screen blend only brightens, so no new colour is introduced. */
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 42% 26% at 57% 64%, rgba(255, 184, 120, 0.15), rgba(255, 184, 120, 0) 70%),
    linear-gradient(to bottom, rgba(255, 176, 110, 0) 48%, rgba(255, 176, 110, 0.06) 60%, rgba(255, 176, 110, 0) 72%);
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Readability scrim: dark floor on phones, fades into the page below. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to top, var(--ink) 0%, rgba(11, 12, 14, 0.86) 22%, rgba(11, 12, 14, 0.3) 46%, rgba(11, 12, 14, 0) 62%),
    linear-gradient(to bottom, rgba(11, 12, 14, 0.22) 0%, rgba(11, 12, 14, 0) 16%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  max-width: 34rem;
}

.hero__mark {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
  color: var(--stone);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.42em;
  /* Letter-spacing adds trailing space after the last letter; offset it. */
  margin-right: -0.42em;
}

/* The warm vertical seam from the master visual, used as a quiet motif. */
.hero__mark::before {
  content: "";
  flex: none;
  width: 1px;
  height: 1.6rem;
  background: linear-gradient(to bottom, rgba(var(--horizon-rgb), 0), var(--horizon));
}

.hero__name {
  font-family: var(--serif);
  font-weight: 400;
  /* Width-driven on phones, but capped by height so landscape phones keep the image. */
  font-size: clamp(2.3rem, min(11.5vw, 12svh), 5.75rem);
  line-height: 1.02;
  letter-spacing: -0.012em;
  color: var(--bright);
  text-wrap: balance;
}

.hero__line {
  margin-top: 1.1rem;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, min(4.6vw, 5svh), 1.6rem);
  line-height: 1.35;
  color: var(--stone);
}

/* Hairline with light entering from the left. */
.hero__fields {
  margin-top: 1.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(220, 215, 206, 0.22);
  border-image: linear-gradient(to right, rgba(var(--horizon-rgb), 0.7), rgba(220, 215, 206, 0.24) 32%, rgba(220, 215, 206, 0.14)) 1;
  color: var(--stone-soft);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* Landscape / desktop: title sits in the open sky to the right of the monolith. */
@media (min-width: 900px) and (min-aspect-ratio: 1/1) {
  .hero {
    align-items: center;
    justify-items: end;
    padding-bottom: var(--gutter);
  }

  .hero__media img {
    object-position: 38% 50%;
  }

  .hero__media::after {
    background:
      radial-gradient(ellipse 30% 30% at 35% 66%, rgba(255, 184, 120, 0.15), rgba(255, 184, 120, 0) 70%),
      radial-gradient(ellipse 22% 24% at 13% 58%, rgba(255, 184, 120, 0.08), rgba(255, 184, 120, 0) 70%),
      linear-gradient(to bottom, rgba(255, 176, 110, 0) 50%, rgba(255, 176, 110, 0.06) 64%, rgba(255, 176, 110, 0) 78%);
  }

  /* A focused scrim behind the text instead of darkening the whole right half,
     so the horizon on the right keeps its light. */
  .hero::after {
    background:
      linear-gradient(to top, var(--ink) 0%, rgba(11, 12, 14, 0) 24%),
      radial-gradient(ellipse 50% 60% at 80% 40%, rgba(11, 12, 14, 0.66) 0%, rgba(11, 12, 14, 0.4) 50%, rgba(11, 12, 14, 0) 100%),
      linear-gradient(to bottom, rgba(11, 12, 14, 0.22) 0%, rgba(11, 12, 14, 0) 18%);
  }

  .hero__content {
    width: min(35rem, 42vw);
    margin-right: clamp(0rem, 3vw, 4rem);
    transform: translateY(-11vh);
  }

  .hero__name {
    font-size: clamp(3rem, 5.4vw, 5.75rem);
  }

  .hero__line {
    font-size: clamp(1.2rem, 1.7vw, 1.6rem);
  }

  .hero__fields {
    color: var(--stone);
    text-shadow: 0 1px 12px rgba(11, 12, 14, 0.9);
  }

  /* A single warm hairline under the hero invites the scroll. */
  .hero::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 1px;
    height: clamp(2.5rem, 7vh, 4.5rem);
    background: linear-gradient(to bottom, rgba(var(--horizon-rgb), 0), rgba(var(--horizon-rgb), 0.75));
  }
}

/* ---------- Sections ---------- */

main {
  display: block;
}

/* Full-width sections so tone can shift between them; content stays at --measure. */
.section {
  display: grid;
  gap: 1.75rem;
  padding: clamp(2.75rem, 8vw, 5.5rem) var(--inline);
}

/* Tonal rhythm: soft transitions, no hard-edged boxes. */
#about {
  padding-top: clamp(4rem, 12vw, 8rem);
  /* Afterglow of the hero light behind the opening statement. Centred inside
     the section and fully transparent at its top edge, so the hero joins it
     without a seam. */
  background: radial-gradient(ellipse 75% 55% at 35% 45%, rgba(var(--horizon-rgb), 0.045), rgba(var(--horizon-rgb), 0) 78%);
}

#current {
  background: linear-gradient(to bottom, rgba(19, 22, 26, 0) 0%, var(--graphite) 22%, var(--graphite) 78%, rgba(19, 22, 26, 0) 100%);
}

#connect {
  padding-bottom: clamp(4.5rem, 12vw, 8rem);
  background:
    radial-gradient(ellipse 60% 75% at 15% 100%, rgba(var(--horizon-rgb), 0.06), rgba(var(--horizon-rgb), 0) 70%),
    linear-gradient(to bottom, var(--ink), var(--graphite-soft));
}

.section__head {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* The light seam, laid along the hairline: a short warm lead-in on the left. */
.section__head::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 3.5rem;
  height: 1px;
  background: linear-gradient(to right, rgba(var(--horizon-rgb), 0.8), rgba(var(--horizon-rgb), 0));
  transform-origin: left;
}

.section__index {
  color: var(--horizon);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
}

.section__title {
  color: var(--stone-soft);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

@media (min-width: 900px) {
  .section {
    grid-template-columns: minmax(12rem, 1fr) minmax(0, 2.6fr);
    gap: 3rem;
  }

  .section__body {
    padding-top: 1rem;
    border-top: 1px solid var(--line);
  }
}

/* About */

.lede {
  max-width: 34ch;
  font-family: var(--serif);
  font-size: clamp(1.55rem, 4.2vw, 2.5rem);
  line-height: 1.3;
  letter-spacing: -0.005em;
  color: #efebe4;
  text-wrap: pretty;
}

.signature {
  margin-top: 1.75rem;
  color: var(--stone-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
}

/* Current */

.current__item {
  display: grid;
  gap: 0.4rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--line);
}

.current__item:first-child {
  padding-top: 0;
}

/* The next section's rule closes the list; avoid a doubled line. */
.current__item:last-child,
.pillars li:last-child {
  border-bottom: 0;
}

.current__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 3.2vw, 1.6rem);
  line-height: 1.25;
  color: #efebe4;
}

.current__text {
  max-width: 44ch;
  text-wrap: pretty;
  color: var(--steel);
}

@media (min-width: 640px) {
  .current__item {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    gap: 2rem;
    align-items: baseline;
  }
}

/* Principles */

.pillars {
  display: grid;
  gap: 0;
}

.pillars li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: clamp(1.25rem, 3.4vw, 1.5rem);
  color: #efebe4;
}

.pillars li:first-child {
  padding-top: 0;
}

@media (min-width: 900px) {
  .pillars {
    grid-template-columns: repeat(5, auto);
    justify-content: space-between;
    gap: 1.5rem;
  }

  .pillars li,
  .pillars li:first-child {
    padding: 0;
    border: 0;
    font-size: clamp(1.15rem, 1.6vw, 1.45rem);
  }
}

/* Connect */

.connect__label {
  color: var(--steel);
  font-size: 0.95rem;
}

.connect__email {
  margin-top: 0.35rem;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 6.2vw, 2.6rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

/* Links: a quiet stone underline; on hover/focus a warm line draws in from
   the left over it. Two background layers, so no layout shift. */
.connect__email a,
.social a {
  text-decoration: none;
  background-image:
    linear-gradient(var(--horizon), var(--horizon)),
    linear-gradient(rgba(220, 215, 206, 0.3), rgba(220, 215, 206, 0.3));
  background-repeat: no-repeat;
  background-position: 0 100%, 0 100%;
  background-size: 0% 1px, 100% 1px;
  transition:
    color 250ms var(--ease),
    background-size 500ms var(--ease),
    transform 250ms var(--ease);
}

.connect__email a {
  padding-bottom: 0.14em;
}

.connect__email a:hover,
.connect__email a:focus-visible,
.social a:hover,
.social a:focus-visible {
  color: #fff;
  background-size: 100% 1px, 100% 1px;
}

.social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.75rem;
  margin-top: 2.5rem;
}

.social a {
  display: inline-block;
  padding: 0.55rem 0 0.4rem;
  color: var(--stone);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  /* No resting underline on the small labels; only the warm reveal. */
  background-size: 0% 1px, 0% 1px;
}

.social a:hover,
.social a:focus-visible {
  transform: translateY(-1px);
}

.connect__handle {
  margin-top: 1rem;
  color: var(--steel-dim);
  font-size: 0.875rem;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding: 0 var(--inline) 2.25rem;
  background: var(--ink-deep);
  color: var(--steel-dim);
  font-size: 0.8rem;
}

.footer::before {
  content: "";
  flex-basis: 100%;
  height: 1px;
  margin-bottom: 1.5rem;
  background: var(--line);
}

.footer__mark {
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  font-weight: 600;
}

/* ---------- 404 ---------- */

.notfound {
  display: grid;
  align-content: center;
  gap: 1.25rem;
  /* Leaves room for the footer below. */
  min-height: 80vh;
  min-height: 80svh;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--gutter);
}

/* Where :has() is supported, the 404 fills the viewport and the footer
   sits at the bottom edge; otherwise the 80vh minimum above applies. */
body:has(> .notfound) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
}

body:has(> .notfound) .notfound {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.notfound h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1.1;
  color: #efebe4;
}

.notfound a {
  color: var(--stone);
  text-underline-offset: 0.3em;
}

/* ---------- Footer link ---------- */

.footer__link {
  margin-left: 1.25rem;
  color: var(--steel);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  text-decoration-color: rgba(220, 215, 206, 0.25);
  transition: color 250ms var(--ease), text-decoration-color 250ms var(--ease);
}

.footer__link:hover,
.footer__link:focus-visible,
.footer__link[aria-current="page"] {
  color: var(--stone);
  text-decoration-color: var(--horizon);
}

/* ---------- Document pages (privacy) ---------- */

.doc {
  max-width: calc(42rem + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) clamp(4rem, 10vw, 6.5rem);
}

.doc__back {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.5rem 0;
  color: var(--stone);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 250ms var(--ease);
}

/* Same warm seam motif as the hero mark. */
.doc__back::before {
  content: "";
  flex: none;
  width: 1px;
  height: 1.4rem;
  background: linear-gradient(to bottom, rgba(var(--horizon-rgb), 0), var(--horizon));
}

.doc__back:hover,
.doc__back:focus-visible {
  color: #fff;
}

.doc__title {
  margin-top: clamp(3rem, 9vw, 5rem);
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.3rem, 8vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--bright);
}

.doc__meta {
  margin-top: 1rem;
  color: var(--steel);
  font-size: 0.875rem;
}

.doc__intro {
  margin-top: 2rem;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  line-height: 1.5;
  color: #efebe4;
  text-wrap: pretty;
}

.doc__section {
  position: relative;
  margin-top: clamp(2.5rem, 7vw, 3.5rem);
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}

.doc__section::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 3.5rem;
  height: 1px;
  background: linear-gradient(to right, rgba(var(--horizon-rgb), 0.8), rgba(var(--horizon-rgb), 0));
}

.doc__section h2 {
  margin-bottom: 1rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.3rem, 3.4vw, 1.55rem);
  line-height: 1.3;
  color: #efebe4;
}

/* Section marker: its own line above the title, small and tracked, in a
   muted tone of the existing warm accent. */
.doc__section h2 span {
  display: block;
  margin-bottom: 0.85rem;
  color: rgba(var(--horizon-rgb), 0.86);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.22em;
  font-variant-numeric: tabular-nums;
}

.doc__section p,
.doc__section li {
  color: var(--steel);
  line-height: 1.7;
  text-wrap: pretty;
}

.doc__section p + p,
.doc__section p + ul,
.doc__section ul + p {
  margin-top: 0.9rem;
}

.doc__section ul {
  display: grid;
  gap: 0.3rem;
}

.doc__section li {
  position: relative;
  padding-left: 1.4rem;
}

/* Hairline dash as the list marker. */
.doc__section li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 0.7rem;
  height: 1px;
  background: rgba(220, 215, 206, 0.35);
}

.doc__section strong {
  color: var(--stone);
  font-weight: 600;
}

.doc a:not(.doc__back) {
  color: var(--stone);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  text-decoration-color: rgba(220, 215, 206, 0.3);
  overflow-wrap: anywhere;
  transition: color 250ms var(--ease), text-decoration-color 250ms var(--ease);
}

.doc a:not(.doc__back):hover,
.doc a:not(.doc__back):focus-visible {
  color: #fff;
  text-decoration-color: var(--horizon);
}

.doc__return {
  margin-top: clamp(3rem, 8vw, 4.5rem);
}

/* ---------- Motion (only when welcome) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero__media img {
    animation: settle 2.4s var(--ease) both;
  }

  /* The warm light arrives once, after the image settles. Not looped. */
  .hero__media::after {
    animation: bloom 2.6s ease-out 0.4s both;
  }

  .hero__content > * {
    animation: rise 1.1s var(--ease) both;
  }

  /* The name is the LCP element: it moves but never starts invisible,
     so Chrome records a paint on the first frame. */
  .hero__name { animation-name: lift; animation-delay: 0ms; }
  .hero__line { animation-delay: 260ms; }
  .hero__fields { animation-delay: 400ms; }

  /* Where scroll-driven animation exists, the warm lead-in on each section
     hairline draws in as the section arrives. Elsewhere it is simply present. */
  @supports (animation-timeline: view()) {
    .section__head::before {
      animation: draw linear both;
      animation-timeline: view();
      animation-range: entry 20% cover 30%;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@keyframes settle {
  from { transform: scale(1.035); }
  to { transform: scale(1); }
}

@keyframes bloom {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes lift {
  from { transform: translateY(0.5rem); }
  to { transform: none; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(0.75rem); }
  to { opacity: 1; transform: none; }
}
