/* Homepage middle section (hero + project tiles). Header, footer and dialogs keep the site's compiled bundle.
   Colors come from the daisyUI theme variables already on <html>, so the header's
   light/dark toggle drives this section too. */

.b3 {
  --b3-display: "Bricolage Grotesque", "Noto Sans", sans-serif;
  --b3-ink: var(--color-base-content);
  --b3-muted: color-mix(in oklab, var(--color-base-content) 62%, transparent);
  --b3-line: color-mix(in oklab, var(--color-base-content) 12%, transparent);
  --b3-surface: var(--color-base-100);
  --b3-surface-2: var(--color-base-200);
  --b3-primary: var(--color-primary);
  --b3-primary-ink: var(--color-primary-content);
  --b3-secondary: var(--color-secondary);
  --b3-radius: 1.25rem;
  --b3-shadow: 0 1px 2px color-mix(in oklab, var(--color-base-content) 6%, transparent),
               0 12px 32px -16px color-mix(in oklab, var(--color-base-content) 22%, transparent);
  display: block;
  padding-top: .75rem;
  color: var(--b3-ink);
}
.b3 * { box-sizing: border-box; }
.b3 h1, .b3 h2, .b3 h3 { font-family: var(--b3-display); letter-spacing: -.02em; margin: 0; }
.b3 p { margin: 0; }
.b3 svg { flex: none; }

/* ---- hero ------------------------------------------------------------ */
.b3-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: 1.35fr .9fr; align-items: center; gap: 1.5rem;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  border-radius: calc(var(--b3-radius) + .25rem);
  background: var(--b3-surface);
  border: 1px solid var(--b3-line);
  box-shadow: var(--b3-shadow);
}
.b3-hero-glow {
  position: absolute; inset: -40%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(38% 45% at 82% 18%, color-mix(in oklab, var(--color-primary) 34%, transparent), transparent 70%),
    radial-gradient(34% 40% at 12% 90%, color-mix(in oklab, var(--color-secondary) 28%, transparent), transparent 70%),
    radial-gradient(28% 30% at 55% 60%, color-mix(in oklab, var(--color-accent) 12%, transparent), transparent 70%);
  filter: blur(28px);
  animation: b3-drift 18s ease-in-out infinite alternate;
}
.b3-hero-grid {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(var(--b3-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--b3-line) 1px, transparent 1px);
  background-size: 2rem 2rem;
  mask-image: radial-gradient(80% 90% at 70% 40%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(80% 90% at 70% 40%, #000 30%, transparent 80%);
  opacity: .7;
}
.b3-eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--b3-muted); margin-bottom: 1rem;
}
.b3-eyebrow-line { width: 1.75rem; height: 2px; border-radius: 2px; background: var(--b3-primary); }
.b3-hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.4rem); line-height: .95; font-weight: 700;
  font-variation-settings: "opsz" 96; margin-bottom: 1rem;
}
.b3-hero h1 em {
  font-style: normal;
  background: linear-gradient(110deg, var(--b3-primary), var(--b3-secondary));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.b3-lead { font-size: 1.05rem; line-height: 1.6; color: var(--b3-muted); max-width: 30ch; margin-bottom: 1.5rem; }
.b3-hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; }

.b3-hero-portrait { position: relative; margin: 0; justify-self: center; width: min(100%, 15rem); aspect-ratio: 1; }
.b3-hero-portrait img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
  box-shadow: var(--b3-shadow);
  animation: b3-morph 14s ease-in-out infinite;
}
.b3-portrait-ring {
  position: absolute; inset: -8%; border-radius: 50%; pointer-events: none;
  border: 1.5px dashed color-mix(in oklab, var(--color-primary) 55%, transparent);
  animation: b3-spin 40s linear infinite;
}
.b3-portrait-ring::after {
  content: ""; position: absolute; top: 6%; left: 50%; width: .7rem; height: .7rem; margin-left: -.35rem;
  border-radius: 50%; background: var(--b3-primary); box-shadow: 0 0 0 4px var(--b3-surface);
}
.b3-chip {
  position: absolute; left: 50%; bottom: -.9rem; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
  padding: .4rem .8rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--b3-surface); border: 1px solid var(--b3-line); box-shadow: var(--b3-shadow);
}
.b3-chip-pulse { width: .5rem; height: .5rem; border-radius: 50%; background: var(--color-success); animation: b3-pulse 2.4s ease-out infinite; }

/* ---- buttons & links --------------------------------------------------- */
.b3-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.1rem; border-radius: 999px; font: inherit; font-size: .9rem; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.b3-btn:active { transform: translateY(1px) scale(.98); }
.b3-btn-solid { background: var(--b3-primary); color: var(--b3-primary-ink); box-shadow: 0 8px 20px -10px var(--b3-primary); }
.b3-btn-solid:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -12px var(--b3-primary); }
.b3-btn-ghost { background: transparent; color: var(--b3-ink); border-color: var(--b3-line); }
.b3-btn-ghost:hover { background: var(--b3-surface-2); }
.b3-btn svg { transition: transform .2s ease; }
.b3-btn:hover svg { transform: translateY(2px); }

.b3-link {
  display: inline-flex; align-items: center; gap: .35rem; align-self: flex-start;
  padding: 0; background: none; border: 0; cursor: pointer; font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--b3-ink); text-decoration: none; position: relative;
}
.b3-link::after {
  content: ""; position: absolute; left: 0; right: 1.2rem; bottom: -3px; height: 1.5px;
  background: var(--b3-primary); transform: scaleX(.35); transform-origin: left; transition: transform .25s ease;
}
.b3-link:hover::after { transform: scaleX(1); }
.b3-link svg { transition: transform .2s ease; }
.b3-link:hover svg { transform: translate(2px, -2px); }
.b3 :focus-visible { outline: 2px solid var(--b3-primary); outline-offset: 3px; border-radius: .4rem; }

/* ---- section head ------------------------------------------------------ */
.b3-bento { margin-top: 2.5rem; }
.b3-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; padding: 0 .25rem; }
.b3-section-head h2 { font-size: 1.6rem; font-weight: 700; }
.b3-section-head p { color: var(--b3-muted); font-size: .9rem; }

/* ---- bento grid -------------------------------------------------------- */
.b3-grid {
  display: grid; gap: .9rem;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(9.5rem, auto);
}
.b3-tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .6rem;
  padding: 1.35rem; margin: 0;
  border-radius: var(--b3-radius); background: var(--b3-surface);
  border: 1px solid var(--b3-line); box-shadow: var(--b3-shadow);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.b3-tile:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--color-primary) 40%, transparent); }
.b3-tile h3 { font-size: 1.35rem; font-weight: 700; line-height: 1.15; }
.b3-tile p { color: var(--b3-muted); font-size: .92rem; line-height: 1.55; }
.b3-tile-meta { display: flex; gap: .4rem; flex-wrap: wrap; }
.b3-tag {
  font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  padding: .25rem .6rem; border-radius: 999px;
  background: color-mix(in oklab, var(--color-primary) 14%, transparent); color: var(--b3-ink);
}
.b3-tag-muted { background: var(--b3-surface-2); color: var(--b3-muted); }
.b3-tile-label { font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--b3-muted) !important; }

/* feature tile — pdfsatranç */
.b3-tile-feature { grid-column: span 4; grid-row: span 2; padding: 0; flex-direction: row; }
.b3-tile-copy { display: flex; flex-direction: column; gap: .6rem; padding: 1.5rem; flex: 1 1 55%; justify-content: flex-start; }
.b3-shot {
  flex: 1 1 45%; position: relative; align-self: end; min-width: 0;
  margin: 4.5rem 0 0 0; transform: translate(1.25rem, 1.1rem) rotate(-3deg);
  border-radius: .9rem .9rem 0 0; overflow: hidden;
  background: var(--b3-surface-2); border: 1px solid var(--b3-line); box-shadow: var(--b3-shadow);
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.b3-tile-feature:hover .b3-shot { transform: translate(.75rem, .35rem) rotate(-1.5deg); }
.b3-shot-bar { display: flex; gap: .3rem; padding: .5rem .6rem; border-bottom: 1px solid var(--b3-line); }
.b3-shot-bar span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--b3-line); }
.b3-shot img { display: block; width: 100%; height: auto; object-fit: cover; object-position: top; max-height: 15rem; }

/* stats tile */
.b3-tile-stats { grid-column: span 2; background: linear-gradient(160deg, color-mix(in oklab, var(--color-primary) 16%, var(--color-base-100)), var(--color-base-100) 70%); }
.b3-tile-stats dl { display: grid; gap: .55rem; margin: .1rem 0 .3rem; }
.b3-tile-stats dl div { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; border-bottom: 1px dashed var(--b3-line); padding-bottom: .35rem; }
.b3-tile-stats dt { font-size: .82rem; color: var(--b3-muted); }
.b3-tile-stats dd { margin: 0; font-family: var(--b3-display); font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }

/* photo tile */
.b3-tile-photo { grid-column: span 2; padding: 0; min-height: 11rem; }
.b3-tile-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; transition: transform .6s ease; }
.b3-tile-photo:hover img { transform: scale(1.04); }
.b3-tile-photo figcaption {
  position: relative; margin-top: auto; padding: 2.5rem 1.1rem .95rem;
  font-family: var(--b3-display); font-weight: 600; font-size: .95rem; line-height: 1.3; color: #fbf7f1;
  background: linear-gradient(to top, rgba(28, 20, 12, .82), rgba(28, 20, 12, 0));
}

/* pdfchess tile */
.b3-tile-project { grid-column: span 3; justify-content: center; }
.b3-tile-piece {
  position: absolute; right: -1rem; bottom: -1.2rem; width: 8.5rem; height: 8.5rem;
  color: color-mix(in oklab, var(--color-primary) 12%, transparent);
  transform: rotate(-8deg); transition: transform .4s ease, color .3s ease;
}
.b3-tile-project:hover .b3-tile-piece { transform: rotate(0) translateY(-4px); color: color-mix(in oklab, var(--color-primary) 22%, transparent); }

/* contact tile */
.b3-tile-contact { grid-column: span 3; justify-content: center; background: var(--color-neutral); color: var(--color-neutral-content); border-color: transparent; }
.b3-tile-contact .b3-tile-label { color: color-mix(in oklab, var(--color-neutral-content) 65%, transparent) !important; }
.b3-tile-contact h3 { font-size: 1.2rem; font-weight: 600; line-height: 1.3; }
.b3-tile-contact .b3-btn-solid { align-self: flex-start; margin-top: .4rem; }
.b3-tile-contact::before {
  content: ""; position: absolute; inset: auto -30% -60% auto; width: 70%; aspect-ratio: 1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, color-mix(in oklab, var(--color-primary) 55%, transparent), transparent 70%);
}
.b3-tile-contact :focus-visible { outline-color: var(--color-neutral-content); }

/* ---- motion ------------------------------------------------------------ */
.b3-reveal { animation: b3-rise .7s cubic-bezier(.2,.8,.2,1) both; }
.b3-reveal:nth-child(2) { animation-delay: .06s; }
.b3-grid .b3-reveal:nth-child(1) { animation-delay: .12s; }
.b3-grid .b3-reveal:nth-child(2) { animation-delay: .18s; }
.b3-grid .b3-reveal:nth-child(3) { animation-delay: .24s; }
.b3-grid .b3-reveal:nth-child(4) { animation-delay: .30s; }
.b3-grid .b3-reveal:nth-child(5) { animation-delay: .36s; }

@keyframes b3-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes b3-drift { from { transform: translate(0, 0) rotate(0); } to { transform: translate(4%, -3%) rotate(8deg); } }
@keyframes b3-spin { to { transform: rotate(360deg); } }
@keyframes b3-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--color-success) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes b3-morph {
  0%, 100% { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; }
  50% { border-radius: 55% 45% 40% 60% / 45% 55% 45% 55%; }
}
@media (prefers-reduced-motion: reduce) {
  .b3 *, .b3 *::before, .b3 *::after { animation: none !important; transition: none !important; }
}

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 720px) {
  .b3-hero { grid-template-columns: 1fr; text-align: left; padding-bottom: 3rem; }
  .b3-hero-portrait { order: -1; width: 9.5rem; justify-self: start; margin-bottom: 1.5rem; }
  .b3-chip { left: 0; transform: none; }
  .b3-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b3-tile-feature { grid-column: span 2; grid-row: auto; flex-direction: column; }
  .b3-shot { align-self: stretch; margin: .25rem 1rem 0 1.25rem; transform: translateY(.5rem) rotate(-1.5deg); }
  .b3-shot img { max-height: 10rem; }
  .b3-tile-stats, .b3-tile-photo, .b3-tile-project, .b3-tile-contact { grid-column: span 2; }
}
@media (min-width: 721px) and (max-width: 900px) {
  .b3-tile-stats dd { font-size: 1.4rem; }
}
