/*
  Hi, thanks for checking out my css code :).
  I hope you enjoy reading my css code. Have fun!
  Best regards, Luca Marceca

  PS: I'm not a designer, so please forgive the ugly css (next time I go with Tailwind again).
*/


:root {
  --paper: #ffffff;
  --ink: #1a1a18;
  --mute: #6a6a6a;
  --rule: #dcdcdc;
  --rule-strong: #1a1a18;
  --electron: #d8000f;
  --gutter: clamp(1rem, 3vw, 2.25rem);
  --rail: 2.75rem;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --sans: "Host Grotesk", "Schibsted Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --measure: 38rem;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dot: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ccircle cx='16' cy='16' r='5' fill='%231a1a18'/%3E%3C/svg%3E") 16 16, auto;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  cursor: var(--dot);
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  --rail: 0px;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  cursor: var(--dot);
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-tap-highlight-color: transparent;
}

body.is-valence {
  --rail: 2.75rem;
}

a,
button,
summary,
label,
[role="button"] {
  cursor: var(--dot);
}

body.is-grid,
body.is-grid * {
  cursor: var(--dot);
}

.dot {
  display: none;
}

@media (pointer: fine) {
  .has-dot,
  .has-dot * {
    cursor: none !important;
  }

  .has-dot .dot {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 400;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--ink);
    pointer-events: none;
    will-change: transform;
    transition: background-color 160ms var(--ease);
  }

  .has-dot.is-hot .dot {
    background: var(--electron);
  }
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
}

dl,
dd,
dt {
  margin: 0;
}

::selection {
  background: var(--electron);
  color: var(--paper);
}

:focus-visible {
  outline: 1px solid var(--electron);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: var(--gutter);
  top: var(--gutter);
  z-index: 40;
  background: var(--paper);
  padding: 0.4rem 0.6rem;
}

/* —— construction —— */
.sheet {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 calc(var(--rail) + var(--safe-r)) 0 var(--safe-l);
  overflow-x: clip;
}

.sheet::before {
  content: "";
  position: fixed;
  inset: 0 calc(var(--rail) + var(--safe-r)) 0 var(--safe-l);
  pointer-events: none;
  z-index: 0;
  background-image: linear-gradient(
    to right,
    transparent calc(100% - 1px),
    rgba(26, 26, 24, 0.07) 0
  );
  background-size: calc(100% / 12) 100%;
}

.sheet::before {
  display: none;
}

body.is-columns .sheet::before {
  display: block;
}

body.is-grid .sheet::after {
  content: "";
  position: fixed;
  inset: 0 calc(var(--rail) + var(--safe-r)) 0 var(--safe-l);
  pointer-events: none;
  z-index: 20;
  background-image: linear-gradient(
    to bottom,
    transparent 7px,
    rgba(26, 26, 24, 0.07) 7px,
    rgba(26, 26, 24, 0.07) 8px,
    transparent 8px
  );
  background-size: 100% 8px;
}

.crop {
  display: none;
  position: fixed;
  z-index: 25;
  width: 14px;
  height: 14px;
  pointer-events: none;
  color: var(--ink);
}

body.is-crop .crop {
  display: block;
}

.crop--tl { top: calc(8px + var(--safe-t)); left: calc(8px + var(--safe-l)); }
.crop--tr { top: calc(8px + var(--safe-t)); right: calc(var(--rail) + var(--safe-r) + 8px); }
.crop--bl { bottom: calc(8px + var(--safe-b)); left: calc(8px + var(--safe-l)); }
.crop--br { bottom: calc(8px + var(--safe-b)); right: calc(var(--rail) + var(--safe-r) + 8px); }

.crop::before,
.crop::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.crop--tl::before,
.crop--tr::before,
.crop--bl::before,
.crop--br::before {
  width: 14px;
  height: 1px;
  top: 6px;
  left: 0;
}

.crop--tl::after,
.crop--tr::after,
.crop--bl::after,
.crop--br::after {
  width: 1px;
  height: 14px;
  left: 6px;
  top: 0;
}

.valence {
  display: none;
  --t: 0;
  --head: 1.45rem;
  --foot: 0.85rem;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: calc(var(--rail) + var(--safe-r));
  z-index: 30;
  border-left: 1px solid var(--rule);
  background: var(--paper);
  padding-right: var(--safe-r);
  overflow: visible;
}

body.is-valence .valence {
  display: block;
}

.valence__seed {
  display: none;
  position: absolute;
  top: 0.7rem;
  left: 50%;
  width: 5px;
  height: 5px;
  transform: translateX(-50%);
  pointer-events: none;
}

.valence__nucleus {
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ink);
}

.valence__rail,
.valence__bond {
  position: absolute;
  left: 50%;
  width: 1px;
  margin-left: -0.5px;
  pointer-events: none;
}

.valence__rail {
  top: var(--head);
  bottom: var(--foot);
  background-image: linear-gradient(
    to bottom,
    var(--ink) 0,
    var(--ink) 2px,
    transparent 2px,
    transparent 6px
  );
  background-size: 1px 6px;
  background-repeat: repeat-y;
  opacity: 0.34;
}

.valence__bond {
  top: 0.82rem;
  height: calc(var(--head) - 0.82rem);
  background: var(--electron);
}

.electron {
  display: block;
  position: absolute;
  left: 50%;
  top: var(--head);
  width: 9px;
  height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: var(--electron);
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(216, 0, 15, 0.16);
}

/* —— frame —— */
.frame {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(1.15rem + var(--safe-t)) var(--pad) calc(1.4rem + var(--safe-b));
}

.mast {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem 2rem;
  align-items: baseline;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--ink);
  min-width: 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav a {
  color: var(--mute);
}

.nav a:hover,
.nav a.is-here {
  color: var(--ink);
}

.nav a.is-here {
  text-decoration: underline;
  text-underline-offset: 0.28em;
  text-decoration-thickness: 1px;
}

.nav__ext {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
}

.nav__ext svg {
  display: block;
  width: 0.52rem;
  height: 0.52rem;
  flex-shrink: 0;
  margin-top: -0.12em;
}

.coords {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--mute);
  text-align: right;
  min-width: 0;
  display: none; /* temporary disabled until I find something cooler */
}

.main {
  flex: 1;
  padding: 1.75rem 0 2.5rem;
}

/* —— wordmark —— */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(11rem, 16rem);
  gap: 1.5rem 2rem;
  align-items: end;
  padding: 0.4rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  margin: 0;
  min-width: 0;
  font-size: clamp(2.15rem, 9.4vw, 10.5rem);
  font-weight: 700;
  line-height: 0.82;
  letter-spacing: -0.07em;
  text-transform: uppercase;
  overflow: hidden;
}

.wordmark span {
  display: block;
  white-space: nowrap;
}

.lede {
  margin: 0;
  position: relative;
  z-index: 1;
  max-width: 16rem;
  font-size: 1.05rem;
  line-height: 1.45;
  letter-spacing: 0;
  min-width: 0;
}

.lede strong {
  font-weight: 600;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 0 1.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--mute);
}

/* —— catalog —— */
.catalog {
  display: flex;
  flex-direction: column;
}

.work {
  width: 100%;
  border-bottom: 1px solid var(--rule);
}

.work summary {
  list-style: none;
  display: block;
  width: 100%;
  padding: 0.95rem 0;
  cursor: pointer;
}

.work summary::-webkit-details-marker,
.work summary::marker {
  display: none;
  content: none;
}

.work__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(11rem, 16rem);
  gap: 0.75rem 1.25rem;
  align-items: baseline;
  width: 100%;
}

.work[open] .work__title {
  transform: translateX(0.35rem);
}

@media (hover: hover) and (pointer: fine) {
  .work summary:hover .work__title {
    transform: translateX(0.35rem);
  }
}

.work__title {
  margin: 0;
  min-width: 0;
  font-size: clamp(1.15rem, 2.4vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  transition: transform 220ms var(--ease);
}

.work__title a {
  color: inherit;
  transition: color 180ms var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .work__title a:hover {
    color: var(--electron);
  }
}

.work__kind,
.work__year {
  justify-self: stretch;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

.work__body {
  padding: 0 0 1.35rem;
  color: var(--mute);
  font-size: 1.05rem;
  line-height: 1.5;
}

.work__copy {
  max-width: 36rem;
}

.work__body p {
  margin: 0;
  color: var(--ink);
}

.work__copy .work__spec {
  margin: 0.45rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  line-height: 1.45;
  color: var(--mute);
}

.work__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin: 0.85rem 0 0;
  font-size: 1.22rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.work__links a {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.work__links a:hover {
  color: var(--electron);
}

.work__more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.7rem 0 0;
  padding: 0;
  border: 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--electron);
  transition: color 180ms var(--ease);
}

.work__more svg {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}

.work__more:hover {
  background: none;
  color: var(--ink);
}

/* —— pages —— */
.kicker {
  margin: 0 0 0.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
}

.page-title {
  margin: 0 0 1.75rem;
  min-width: 0;
  font-size: clamp(2.6rem, 14vw, 8.5rem);
  font-weight: 700;
  line-height: 0.82;
  letter-spacing: -0.07em;
  text-transform: uppercase;
}

.page-title--work {
  font-size: clamp(2.1rem, 8.5vw, 5.4rem);
  max-width: 18ch;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(14rem, 0.7fr);
  gap: 2.5rem 4rem;
  align-items: start;
}

.split--about {
  grid-template-rows: auto 1fr;
}

.split--about .portrait {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
}

.split--about .prose {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.split--about aside {
  grid-column: 2;
  grid-row: 2;
}

.portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 62% 40%;
  border: 1px solid var(--ink);
}

.error-gif {
  margin: 0;
}

.error-gif img {
  display: block;
  width: 100%;
  height: auto;
}

.prose {
  max-width: var(--measure);
  font-size: 1.05rem;
  line-height: 1.5;
  letter-spacing: 0;
}

.prose p {
  margin: 0 0 1.05rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.spec {
  border-top: 1px solid var(--ink);
}

.spec__row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.05rem;
}

.spec__k {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  padding-top: 0.18rem;
}

.spec a:hover {
  color: var(--electron);
}

.prose h2 {
  margin: 1.85rem 0 0.55rem;
  font-size: 0.75rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.prose a:hover {
  color: var(--electron);
}

.project-intro {
  margin: 0 0 1.4rem;
  max-width: 36rem;
  font-size: 1.05rem;
  line-height: 1.5;
  letter-spacing: 0;
}

.kicker a:hover {
  color: var(--electron);
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1.4rem;
  margin: 0 0 2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-actions a {
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.project-actions a:hover {
  color: var(--electron);
}

.snippets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 1px;
  margin-top: 1.5rem;
  border: 1px solid var(--ink);
  background: var(--ink);
}

.snippets img {
  width: 100%;
  aspect-ratio: 9 / 19;
  object-fit: cover;
  background: var(--paper);
}

.opt-block {
  margin: 0 0 1.1rem;
}

.opt-block strong {
  display: block;
  margin-bottom: 0.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.opt-block ul {
  margin: 0;
  padding-left: 1.1rem;
}

.opt-block li + li {
  margin-top: 0.15rem;
}

.atom {
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  width: 148px;
  height: 148px;
  color: var(--ink);
}

.atom circle.orbit {
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
}

.atom .core {
  fill: var(--ink);
}

.atom .e {
  fill: var(--electron);
}

/* —— journal —— */
.journal {
  display: flex;
  flex-direction: column;
}

.entry {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem 2rem;
  padding: 1.2rem 0 1.35rem;
  border-bottom: 1px solid var(--rule);
}

.entry:first-of-type {
  border-top: 1px solid var(--ink);
}

.entry time {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--mute);
  padding-top: 0.35rem;
}

.entry h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.25rem, 2.6vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.entry p {
  margin: 0;
  max-width: 36rem;
  color: var(--mute);
  font-size: 1.05rem;
  line-height: 1.5;
}

.entry:hover h2 {
  color: var(--electron);
}

/* —— legal —— */
.legal {
  max-width: 40rem;
}

.legal h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.legal .dates {
  margin: 0 0 1.6rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.legal h2 {
  margin: 1.8rem 0 0.55rem;
  font-size: 0.75rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legal p,
.legal li {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--ink);
  overflow-wrap: break-word;
}

.legal ul {
  margin: 0 0 1rem;
  padding-left: 1.1rem;
}

.legal li + li {
  margin-top: 0.25rem;
}

/* —— colophon —— */
.colophon {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--mute);
}

.colophon a:hover {
  color: var(--ink);
}

/* —— responsive —— */
@media (max-width: 1100px) {
  :root {
    --pad: clamp(1.1rem, 3.2vw, 2.25rem);
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 1rem;
  }

  .lede {
    max-width: 34rem;
  }
}

@media (max-width: 900px) {
  .split,
  .entry {
    grid-template-columns: 1fr;
  }

  .split {
    gap: 2rem;
  }

  .split--about .portrait,
  .split--about .prose,
  .split--about aside {
    grid-column: auto;
    grid-row: auto;
  }

  .page-title {
    font-size: clamp(2.6rem, 16vw, 6.5rem);
  }
}

@media (max-width: 720px) {
  :root {
    --rail: 1.35rem;
    --pad: clamp(0.9rem, 4.8vw, 1.35rem);
  }

  body.is-valence {
    --rail: 1.35rem;
  }

  .crop,
  body.is-crop .crop {
    display: none;
  }

  .sheet::before {
    background-size: calc(100% / 4) 100%;
  }

  .coords {
    display: none;
  }

  .valence {
    --head: 1.2rem;
    --foot: 0.55rem;
  }

  .mast {
    grid-template-columns: 1fr;
    padding-bottom: 0.75rem;
  }

  .nav {
    gap: 0.15rem 1.15rem;
  }

  .main {
    padding: 1.25rem 0 1.75rem;
  }

  .wordmark {
    font-size: clamp(2rem, 12vw, 3.6rem);
    letter-spacing: -0.06em;
  }

  .page-title {
    margin-bottom: 1.25rem;
    font-size: clamp(2.35rem, 18vw, 4.2rem);
  }

  .meta-line {
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 1.2rem;
  }

  .work__row {
    grid-template-columns: 1fr;
    gap: 0.45rem 0.85rem;
  }

  .work__kind {
    display: none;
  }

  .work__title {
    font-size: clamp(1.12rem, 5.2vw, 1.45rem);
  }

  .work[open] .work__title {
    transform: none;
  }

  .work__body {
    padding-bottom: 1.1rem;
    font-size: 1.05rem;
  }

  .atom {
    width: 112px;
    height: 112px;
    margin-top: 1.6rem;
  }

  .colophon {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.7rem;
  }

  .portrait {
    max-width: 22rem;
  }

  .legal h1 {
    font-size: clamp(1.85rem, 11vw, 2.6rem);
  }
}

@media (max-width: 420px) {
  .spec__row {
    grid-template-columns: 1fr;
    gap: 0.15rem 0.75rem;
    padding: 0.55rem 0;
  }

  .spec__k {
    padding-top: 0;
  }

  .work__row {
    grid-template-columns: 1fr;
  }

  .nav {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
  }
}

@media (pointer: coarse) {
  .nav a {
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
  }

  .work summary {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .electron {
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
  }

  .colophon a,
  .work__links a,
  .work__more,
  .spec a {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
  }
}

@media (hover: none) {
  .has-dot .dot {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .work__title {
    transition: none;
  }
}
