/* nemophila.dev v3.1. A Nemophila meadow at blue hour; daylight as the alternative.
   Rules and palette: 02_Identyfikacja_Wizualna/design-system.md */

/* ===== Tokens: dark (default). Contrast on sky/ground/surface in comments. ===== */
:root,
[data-theme="dark"] {
  --sky: #141A2E;       /* top of the page: dusk sky */
  --ground: #0F1512;    /* bottom of the page: grass at night */
  --surface: #18211C;   /* one tone step up from the ground, for a section */
  --ink: #E8E4D8;       /* the paper, used as ink: 13.6 / 14.5 / 13.0 */
  --ink-2: #A7AFA6;     /* secondary text: 7.7 / 8.2 / 7.3 */
  --link: #86B8EA;      /* petal blue, brightest colour after text (Purkinje): 8.3 / 8.9 / 7.9 */
  --link-line: #3D6CB0;
  --line: #6B8C58;      /* stem: table rules, 4.5 / 4.9 / 4.3 */
  --todo: #86B8EA;
  --todo-bg: rgba(134, 184, 234, 0.1);
  --grain: 0.045;
  --dots: url("assets/dots-dark.svg");
  /* flower colours (read by the inline SVGs) */
  --fl-petal: #86B8EA; --fl-deep: #3D6CB0; --fl-rim: #C3DCF5; --fl-centre: #F2EFE6;
  --fl-ink: #1F2347; --fl-vein: #3D6CB0; --fl-stem: #6B8C58; --fl-line: #3D6CB0;
  color-scheme: dark;
}

[data-theme="light"] {
  --sky: #F4F1EA;
  --ground: #F4F1EA;    /* daylight: one flat paper, no gradient */
  --surface: #ECE8DD;
  --ink: #1E2620;       /* 13.8 on paper, 12.7 on surface */
  --ink-2: #3A433C;     /* 9.1 / 8.4 */
  --link: #2B2F5C;      /* 11.2 */
  --link-line: #6FA8DC;
  --line: #55703F;
  --todo: #4F86C6;
  --todo-bg: rgba(79, 134, 198, 0.08);
  --grain: 0.03;
  --dots: url("assets/dots.svg");
  --fl-petal: #6FA8DC; --fl-deep: #4F86C6; --fl-rim: #B7D4F0; --fl-centre: #FFFFFF;
  --fl-ink: #2B2F5C; --fl-vein: #4F86C6; --fl-stem: #55703F; --fl-line: #2B2F5C;
  color-scheme: light;
}

:root {
  --head: "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;  /* headings only */
  --body: "Literata", Georgia, serif;                               /* everything else */
  --edge: 5vw;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  color: var(--ink);
  /* the only background gradient: the horizon, from sky to ground */
  background: var(--ground) linear-gradient(180deg, var(--sky) 0%, var(--sky) 12%, var(--ground) 100%);
  font: 400 1.1875rem/1.55 var(--body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
/* fine grain so the dark tones are not digitally flat */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}
img, svg { display: block; max-width: 100%; }
h1, h2 { margin: 0; font-family: var(--head); font-weight: 600; letter-spacing: -0.03em; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }
[data-theme="dark"] .only-light, [data-theme="light"] .only-dark { display: none; }

.skip { position: absolute; left: var(--edge); top: -60px; z-index: 10; padding: 6px 10px; background: var(--link); color: var(--sky); }
.skip:focus { top: 8px; }

/* One CTA style for the whole page: an underlined text link (the theme switch too) */
.link {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: max(2px, 0.08em);
  text-underline-offset: 0.18em;
}
.link:hover { text-decoration-color: var(--link); }
button.link { font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* Placeholders the author still has to fill. Visible on purpose, in both themes. */
.todo { outline: 1.5px dashed var(--todo); outline-offset: 2px; background: var(--todo-bg); color: var(--ink); }

/* ===== Header ===== */
.top {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.5rem var(--edge);
}
.mark { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--ink); text-decoration: none; }
.mark span { font: 600 1.15rem/1 var(--head); letter-spacing: -0.02em; }
.top-right { display: flex; align-items: baseline; gap: 1.6rem; font-size: 1.0625rem; }

/* ===== Hero: flowers sit beside the text, never behind letters ===== */
.hero {
  position: relative;
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 2vw;
  min-height: 92vh;
  padding: 30vh var(--edge) 4vw;
  align-content: end;
}
.hero-flower { position: absolute; z-index: 1; width: 52vw; right: -7vw; top: 5.5rem; pointer-events: none; }
.far-flower {
  position: absolute; z-index: 0; width: 13vw; left: 41vw; top: 7rem; pointer-events: none;
  /* further away: smaller, darker, less saturated */
  --fl-petal: #5E83AA; --fl-deep: #2F4A73; --fl-rim: #7B9BBF; --fl-centre: #B8BCB6;
  --fl-ink: #151A30; --fl-vein: #2F4A73; --fl-stem: #4A6040; --fl-line: #2F4A73;
}
[data-theme="light"] .far-flower {
  --fl-petal: #7C98B5; --fl-deep: #5A7593; --fl-rim: #A9BDD2; --fl-centre: #E6E4DC;
  --fl-ink: #3A3F5E; --fl-vein: #5A7593; --fl-stem: #6D7F5F; --fl-line: #4A5878;
}
.hero h1 {
  position: relative; z-index: 2;
  grid-column: 1 / span 6;
  font-size: clamp(3.1rem, 9vw, 9.4rem);
  line-height: 0.9; letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}
.hero h1.h1-sentence { font-size: clamp(2.4rem, 5.4vw, 5.6rem); line-height: 0.98; }
.hero-line {
  position: relative; z-index: 2;
  grid-column: 2 / span 4;
  margin-top: 2.4rem;
  font-size: 1.3125rem; line-height: 1.5;
}

/* The one animation: the near flower opens once, petal by petal */
.hero-flower .p { transform-box: view-box; transform-origin: 470px 430px; }
@media (prefers-reduced-motion: no-preference) {
  .hero-flower .p { animation: open 1.5s cubic-bezier(0.2, 0.75, 0.25, 1) both; }
  .hero-flower .c { animation: show 0.5s 1s both; }
}
@keyframes open { from { transform: rotate(-32deg) scale(0.06); opacity: 0; } 45% { opacity: 1; } to { transform: none; } }
@keyframes show { from { opacity: 0; } }

/* ===== Projects: an index on a surface one tone up, heading on a rail ===== */
.projects {
  display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 2vw;
  margin-top: 8vw; padding: 5.5vw var(--edge) 6vw;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}
.projects h2 { grid-column: 1 / span 3; font-size: clamp(2rem, 3.2vw, 3.1rem); line-height: 1; }
.index { grid-column: 4 / -1; width: 100%; border-collapse: collapse; }
.index th {
  text-align: left; font-weight: 600; font-size: 1.0625rem; color: var(--ink-2);
  padding: 0 1.4rem 0.9rem 0; border-bottom: 2px solid var(--ink);
}
.index td { padding: 1.15rem 1.6rem 1.15rem 0; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.index td:nth-child(2) { font-variant-numeric: tabular-nums; white-space: nowrap; }
.index td:nth-child(3) { white-space: nowrap; }
.index td.name { position: relative; font-weight: 600; font-size: 1.3rem; line-height: 1.3; }
/* five-fold hover marker: the mark itself, in the gutter */
.index tr:hover td.name::before {
  content: ""; position: absolute; left: -2.1rem; top: 1.3rem;
  width: 1.3rem; height: 1.3rem; background: url("assets/mark.svg") center / contain no-repeat;
}

/* Speckle strip: the dots from the flower centre */
.speckle {
  height: 24px; width: 44vw;
  margin: 7vw 0 0 calc(var(--edge) + 23vw);
  background: var(--dots) left center / 240px 24px repeat-x;
}

/* ===== About: photo cut hard against the left edge ===== */
.about {
  display: grid; grid-template-columns: minmax(0, 363px) 1fr; column-gap: 8vw;
  margin-top: 3vw; padding-right: var(--edge);
  align-items: center;  /* text in the middle of the photo: about half the old gap below the dots */
}
.meadow { margin: 0; }
.meadow img { width: 100%; height: 540px; object-fit: cover; object-position: 50% 78%; }
.meadow figcaption { margin-top: 0.7rem; padding-left: var(--edge); font-size: 1.0625rem; color: var(--ink-2); }
.about-text { max-width: 34rem; }
.about-text h2 { font-size: clamp(1.9rem, 2.6vw, 2.5rem); line-height: 1; margin-bottom: 1.4rem; }
.about-text p + p { margin-top: 1rem; }

/* ===== Contact: the address is the call to action ===== */
.contact { position: relative; padding: 17vw var(--edge) 8vw; }
.contact-flower { position: absolute; z-index: 0; width: 24vw; right: -3vw; top: 1vw; }
.contact h2 { position: relative; z-index: 1; margin-left: 31vw; font-size: 1.6rem; font-weight: 500; color: var(--ink-2); }
.contact .big {
  position: relative; z-index: 1; display: inline-block; margin-top: 1.2rem;
  font: 600 clamp(2rem, 6vw, 6.2rem)/1 var(--head); letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

/* ===== Footer: small, informal ===== */
.foot { padding: 0 var(--edge) 2rem; font-size: 1.0625rem; color: var(--ink-2); }

/* ===== Narrow screens ===== */
@media (max-width: 760px) {
  .top-mail { display: none; }  /* the address is in #contact; no room next to the mark */
  .hero { padding-top: calc(5rem + 62vw); min-height: 0; }
  .hero-flower { width: 60vw; right: -6vw; top: 4.5rem; }
  .far-flower { width: 24vw; left: 8vw; top: 7rem; }
  .hero h1, .hero-line { grid-column: 1 / -1; }
  .hero h1 { font-size: 3.4rem; }
  .hero-line { margin-top: 1.6rem; font-size: 1.1875rem; }

  .projects { display: block; margin-top: 3.5rem; padding: 2.6rem var(--edge) 2.8rem; }
  .projects h2 { margin-bottom: 1.2rem; }
  .index thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .index, .index tbody { display: block; }
  .index tr { display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; padding: 1rem 0; border-top: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
  .index td { padding: 0; border: 0; }
  .index td.name { grid-column: 1 / -1; margin-bottom: 0.3rem; }
  .index td:nth-child(4) { grid-column: 1 / -1; margin-top: 0.4rem; }
  .index tr:hover td.name::before { display: none; }

  .speckle { width: 70vw; margin: 3rem 0 0 var(--edge); }

  .about { display: block; padding: 0; margin-top: 1.6rem; }
  .meadow img { height: 420px; }
  .about-text { padding: 2.2rem var(--edge) 0; }

  .contact { padding-top: calc(3rem + 40vw); padding-bottom: 5rem; }
  .contact h2 { margin-left: 0; }
  .contact-flower { width: 44vw; right: -8vw; top: 1.5rem; }
}
