/* Alfidia Studios — shared design tokens */
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans-latin-wght.woff2") format("woff2");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colour (provisional, from brief) */
  --color-background: #F6F1E8;
  --color-surface: #FFFCF6;
  --color-brand: #FF650D;          /* identity accents only, never small text */
  --color-brand-strong: #B5450A;   /* functional orange: text, buttons (4.9:1 on cream) */
  --color-brand-stronger: #983906; /* hover/active */
  --color-text: #242320;
  --color-text-muted: #625A50;
  --color-border: #D9D0C3;
  --color-field: #242320;

  /* Type */
  --font-sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fs-hero: clamp(2.25rem, 1.4rem + 3.6vw, 4rem);         /* 36 → 64 */
  --fs-section: clamp(1.75rem, 1.45rem + 1.25vw, 2.5rem);   /* 28 → 40 */
  --fs-panel: clamp(1.5rem, 1.35rem + 0.6vw, 2rem);         /* 24 → 32 */
  --fs-card: clamp(1.25rem, 1.2rem + 0.25vw, 1.5rem);       /* 20 → 24 */
  --fs-lead: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);      /* 17 → 20 */
  --fs-body: clamp(1rem, 0.97rem + 0.12vw, 1.0625rem);      /* 16 → 17 */
  --fs-ui: 1rem;                                            /* 16 */
  --fs-meta: 0.875rem;                                      /* 14 */

  /* Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 80 / 96 */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --space-9: 80px; --space-10: 96px;

  --container: 1200px;
  --gutter: 20px;
  --section-gap: var(--space-8);
  --grid-gap: var(--space-5);
  --card-pad: var(--space-5);
  --header-h: 76px;

  --radius-control: 12px;
  --radius-card: 22px;
  --border: 1px solid var(--color-border);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 180ms;
}

@media (min-width: 700px) {
  :root { --gutter: 30px; --section-gap: var(--space-9); --grid-gap: var(--space-6); --card-pad: var(--space-6); }
}
@media (min-width: 1100px) {
  :root { --gutter: 44px; --section-gap: var(--space-10); --header-h: 96px; }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { margin: 0; font-weight: 700; color: var(--color-text); text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }

a { color: var(--color-brand-strong); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 1px; transition: color var(--dur) var(--ease), text-decoration-thickness var(--dur) var(--ease); }
a:hover { color: var(--color-brand-stronger); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--color-text); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: calc(var(--container) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 100; padding: var(--space-3) var(--space-4); background: var(--color-text); color: var(--color-surface); border-radius: var(--radius-control); }
.skip-link:focus { top: var(--space-4); }

.meta { font-size: var(--fs-meta); line-height: 1.4; color: var(--color-text-muted); }
.lead { font-size: var(--fs-lead); line-height: 1.55; color: var(--color-text-muted); max-width: 52ch; }
.tag {
  display: inline-block; font-size: var(--fs-meta); line-height: 1.4; font-weight: 600;
  color: var(--color-text); background: var(--color-background);
  border: 1px dashed var(--color-text-muted); border-radius: 8px; padding: 2px var(--space-2);
}

/* A. Header */
.site-header { position: sticky; top: 0; z-index: 50; background: var(--color-background); border-bottom: 1px solid transparent; transition: border-color var(--dur) var(--ease); }
.site-header.is-scrolled { border-bottom-color: var(--color-border); }
body.menu-open { overflow: hidden; }
.header-inner { min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); position: relative; }
.brand { display: block; padding: var(--space-4) 0; margin-left: -2px; border-radius: 8px; }
.brand img { width: 176px; height: auto; }
@media (min-width: 700px) { .brand img { width: 204px; } }
@media (min-width: 1100px) { .brand img { width: 240px; } }

.site-nav ul { display: flex; align-items: center; gap: var(--space-2); }
.site-nav a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--space-4);
  font-size: var(--fs-ui); font-weight: 600; line-height: 1.3; color: var(--color-text);
  text-decoration: none; border-radius: var(--radius-control);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.site-nav a:hover { background: var(--color-surface); color: var(--color-text); text-decoration: underline; text-underline-offset: 0.25em; }
.site-nav .nav-cta { background: var(--color-brand-strong); color: var(--color-surface); padding: 0 var(--space-5); margin-left: var(--space-2); }
.site-nav .nav-cta:hover { background: var(--color-brand-stronger); color: var(--color-surface); }

.menu-toggle {
  display: none; min-height: 44px; padding: 0 var(--space-5);
  font: 600 var(--fs-ui)/1.3 var(--font-sans); color: var(--color-text);
  background: var(--color-surface); border: var(--border); border-radius: var(--radius-control); cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.menu-toggle:hover { background: #fff; }

@media (max-width: 759px) {
  .menu-toggle { display: inline-flex; align-items: center; }
  .site-nav { display: none; position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; z-index: 60; overflow-y: auto; overscroll-behavior: contain; background: var(--color-background); border-top: var(--border); padding: var(--space-4) var(--gutter) var(--space-7); }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; gap: var(--space-1); }
  .site-nav a { width: 100%; padding: 0 var(--space-4); }
  .site-nav .nav-cta { margin: var(--space-2) 0 0; justify-content: center; }
}

/* B. Intro */
.intro { padding-top: var(--space-6); padding-bottom: var(--space-7); }
.intro h1 { font-size: var(--fs-hero); line-height: 1.08; letter-spacing: -0.02em; max-width: 20em; }
.intro .lead { margin-top: var(--space-5); }
@media (min-width: 1100px) { .intro { padding-top: var(--space-7); } }

/* C. Panels */
.panels { display: grid; grid-template-columns: 1fr; gap: var(--grid-gap); }
@media (min-width: 960px) { .panels { grid-template-columns: 1fr 1fr; } }
.panel {
  display: grid; grid-template-rows: auto 1fr auto; gap: var(--space-5);
  background: var(--color-surface); border: var(--border); border-radius: var(--radius-card);
  padding: var(--card-pad); min-width: 0;
}
.panel-head h2 { font-size: var(--fs-panel); line-height: 1.2; letter-spacing: -0.01em; }
.panel-head p { margin-top: var(--space-2); color: var(--color-text-muted); max-width: 52ch; }
.panel-stage { border-radius: 16px; overflow: hidden; min-width: 0; }
.panel-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3) var(--space-5); padding-top: var(--space-4); border-top: var(--border); }
.text-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: var(--fs-ui); font-weight: 600; line-height: 1.3; }

/* Websites LCD: the supplied demo runs at its native size and scrolls inside the display. */
.stage-lcd { display: flex; min-height: 440px; border: var(--border); background: var(--color-background); }
.stage-lcd iframe { display: block; flex: 1; width: 100%; min-height: 440px; border: 0; background: var(--color-background); }
@media (min-width: 960px) { .stage-lcd, .stage-lcd iframe { min-height: 480px; } }

.stage-game iframe { display: block; width: 100%; height: 520px; border: 0; background: var(--color-surface); }

/* Sections */
.section { padding-top: var(--section-gap); }
.section-head { margin-bottom: var(--space-6); }
.section-head h2, .about h2, .contact h2 { font-size: var(--fs-section); line-height: 1.15; letter-spacing: -0.015em; }
.section-head p { margin-top: var(--space-4); color: var(--color-text-muted); max-width: 60ch; }

.card-grid { display: grid; grid-template-columns: 1fr; gap: var(--grid-gap); }
@media (min-width: 700px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .card-grid { grid-template-columns: repeat(3, 1fr); } .card-grid-2 { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--color-surface); border: var(--border); border-radius: var(--radius-card); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.card-media { aspect-ratio: 16 / 9; background: var(--color-background); border-bottom: var(--border); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: var(--card-pad); display: grid; gap: var(--space-3); align-content: start; }
.card-body h3 { font-size: var(--fs-card); line-height: 1.25; }
.card-body p:not(.meta):not(.tag) { color: var(--color-text-muted); max-width: 62ch; }
.card-body .tag { justify-self: start; }
.status { font-weight: 600; color: var(--color-text); }

/* Software projects: primary image, then secondary. Proportions preserved, never cropped. */
.project-shots { display: grid; grid-template-columns: 1fr; gap: var(--space-4); padding: var(--space-4) var(--space-4) 0; }
.shot { margin: 0; display: grid; gap: var(--space-2); }
.shot-secondary { grid-template-columns: minmax(0, 46%) 1fr; align-items: center; gap: var(--space-4); }
.shot-btn {
  display: block; width: 100%; padding: 0; border: var(--border); border-radius: 14px; overflow: hidden;
  background: var(--color-background); cursor: zoom-in; transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.shot-btn:hover { border-color: var(--color-text-muted); }
.shot-btn:active { transform: scale(0.995); }
.shot-btn img { width: 100%; height: auto; }

.lightbox { padding: 0; border: 0; background: transparent; max-width: 100vw; max-height: 100vh; }
.lightbox::backdrop { background: rgba(36, 35, 32, 0.86); }
.lightbox-inner { display: grid; gap: var(--space-3); justify-items: center; padding: var(--space-4); }
.lightbox-inner img { max-width: min(1600px, calc(100vw - 32px)); max-height: calc(100vh - 140px); width: auto; height: auto; border-radius: 12px; }
.lightbox-caption { color: var(--color-background); font-size: var(--fs-meta); }
.lightbox-close {
  justify-self: end; min-height: 44px; padding: 0 var(--space-5); font: 600 var(--fs-ui)/1.3 var(--font-sans);
  color: var(--color-text); background: var(--color-surface); border: 0; border-radius: var(--radius-control); cursor: pointer;
}
.lightbox-close:hover { background: #fff; }
.lightbox-close:focus-visible { outline-color: var(--color-surface); }

/* F. About */
.about { display: grid; gap: var(--space-7); align-items: center; }
@media (min-width: 900px) { .about { grid-template-columns: 1.1fr 1fr; gap: var(--space-8); } }
.about-copy { display: grid; gap: var(--space-4); }
.about-copy p { max-width: 62ch; }
.about-copy h2 { margin-bottom: var(--space-2); }
.about-mark { padding: var(--space-4); }
.about-mark img { width: 100%; max-width: 440px; margin-inline: auto; }

/* G. Contact */
.contact {
  background: var(--color-surface); border: var(--border); border-radius: var(--radius-card);
  padding: var(--space-6) var(--card-pad); display: grid; gap: var(--space-7);
}
@media (min-width: 900px) { .contact { grid-template-columns: 1fr 1.25fr; gap: var(--space-8); padding: var(--space-8) var(--space-7); } }
.contact-intro { display: grid; gap: var(--space-4); align-content: start; }
.contact-details { margin-top: var(--space-4); display: grid; gap: var(--space-3); }
.contact-name { font-weight: 600; }
.contact-list { display: grid; gap: var(--space-2); }
.contact-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); }
.contact-list .meta { min-width: 3.5rem; }
.contact-list a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; overflow-wrap: anywhere; }

.contact-form { display: grid; gap: var(--space-5); }
.field-row { display: grid; gap: var(--space-5); }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: var(--space-2); min-width: 0; }
.field label { font-size: var(--fs-ui); font-weight: 600; line-height: 1.3; }
.field .req, .field .opt { font-weight: 400; color: var(--color-text-muted); font-size: var(--fs-meta); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4);
  font: 400 1rem/1.5 var(--font-sans); color: var(--color-text);
  background: var(--color-background); border: 1px solid #b8ad9e; border-radius: var(--radius-control);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.field textarea { resize: vertical; min-height: 140px; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23242320' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--color-text-muted); }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--color-text); outline-offset: 1px; background-color: var(--color-surface); }
.contact-form.was-validated :invalid { border-color: var(--color-brand-strong); }
.form-actions { display: grid; gap: var(--space-3); justify-items: start; }
.form-actions .btn { min-width: 180px; }
.form-error { color: var(--color-text); font-size: var(--fs-meta); line-height: 1.4; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-brand-strong); border-radius: var(--radius-control); background: var(--color-background); }
.form-success { padding: var(--space-6); border: var(--border); border-radius: 16px; background: var(--color-background); }
.form-success:focus { outline: none; }
.form-success-title { font-size: var(--fs-card); font-weight: 700; line-height: 1.3; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 var(--space-5);
  font: 600 var(--fs-ui)/1.3 var(--font-sans); color: var(--color-surface); background: var(--color-brand-strong);
  border: 0; border-radius: var(--radius-control); cursor: pointer; text-decoration: none;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { background: var(--color-brand-stronger); }
.btn:active { transform: translateY(1px); }
.btn:disabled { background: var(--color-border); color: var(--color-text-muted); cursor: not-allowed; transform: none; }

/* H. Footer */
.site-footer { margin-top: var(--section-gap); border-top: var(--border); padding: var(--space-7) 0; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4) var(--space-6); }
.footer-name { font-weight: 700; }
.footer-contact { display: grid; gap: var(--space-1); }
.footer-contact a { color: var(--color-text-muted); overflow-wrap: anywhere; }
.footer-contact a:hover { color: var(--color-text); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); color: var(--color-text); font-size: var(--fs-ui); font-weight: 500; }

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

/* Narrow phones: let both displays use the panel's full width so in-frame controls keep their size. */
@media (max-width: 420px) {
  .panel-stage { margin-inline: calc(var(--card-pad) * -1); border-radius: 0; }
  .stage-lcd { border-inline: 0; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.card-body .text-link { justify-self: start; }
.shots-pair { grid-template-columns: 1fr 1fr; align-items: start; }
