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

:root {
  --bg: #ffffff;
  --fg: #000000;
  --block-text: #ffffff;
  --muted: #999;

  /* SCALE: 1 design pixel. The blocks were designed 720px wide.
     On smaller screens --u shrinks so everything scales down together. */
  --design-width: 720;
  --u: min(1px, calc((100vw - 48px) / var(--design-width)));

  /* LOCK */
  --lock-font: calc(200 * var(--u));

  /* LAMP */
  --lamp-font:       calc(145 * var(--u));
  --lamp-bar-height:  calc(60 * var(--u));

  /* GLIMPO */
  --glimpo-font: calc(120 * var(--u));

  /* CONFESSION BOX */
  --confession-font:    calc(112 * var(--u));
  --confession-spacing: calc(-3 * var(--u));

  /* WEBPAGES */
  --web-font:    calc(100 * var(--u));
  --web-stretch: 1.7;

  /* LAYOUT */
  --row-gap: max(4px, calc(8 * var(--u)));
  --top-ratio: 1.8fr 1fr;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Times New Roman', Times, serif;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
}

html.dark {
  --bg: #000000;
  --fg: #ffffff;
  --block-text: #000000;
  --muted: #555;
}

/* ── NAV ── */
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  font-size: 13px;
  letter-spacing: 0.01em;
  position: sticky;                   /* stays at the top while you scroll */
  top: 0;
  z-index: 5;
  background: var(--bg);
  transition: background 0.3s;
}

.nav-left { display: flex; gap: 20px; align-items: center; }
.nav-right { display: flex; gap: 16px; align-items: center; }

nav a, nav span, nav button {
  color: var(--fg);
  text-decoration: none;
  font-family: 'Times New Roman', Times, serif;
  font-size: 13px;
  font-weight: normal;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: none;
  border: none;
  transition: color 0.3s;
}

nav a:hover, nav span:hover { text-decoration: underline; }

.site-name:hover { text-decoration: none !important; cursor: pointer; }

.toggle-btn {
  padding: 0;
  border: none !important;
  border-radius: 0;
  transition: all 0.3s;
}
.toggle-btn:hover { text-decoration: underline; }
.toggle-btn.active { background: none; color: var(--fg); }

/* ── MAIN ── */
main {
  padding: 40px 24px 60px;
  max-width: 768px;                   /* 720px of blocks + 24px each side */
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;            /* centers the stack on the screen */
  min-height: calc(100vh - 47px);
  min-height: calc(100svh - 47px);    /* iPhone: ignores the moving Safari bar */     /* screen height minus the nav */
  gap: var(--row-gap);
}

/* ── ROW 1: LOCK + LAMP ── */
.row-top {
  display: grid;
  grid-template-columns: var(--top-ratio);
  gap: var(--row-gap);
  align-items: stretch;
}

/* ── SHARED BLOCK STYLES ── */
.proj-block {
  position: relative;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.3s, opacity 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: hidden;
}


.block-lamp,
.block-confession {
  background: var(--fg);
}

.proj-title {
  font-family: Impact, 'Anton', 'Arial Narrow', sans-serif;
  font-weight: normal;
  color: var(--block-text);
  line-height: 0.9;
  white-space: nowrap;
  display: inline-block;
  transition: color 0.3s;
  text-align: center;
  padding: calc(20 * var(--u)) calc(30 * var(--u));
  margin: 0;
  transform-origin: center;
}

/* ── LOCK ── */
.block-lock .proj-title {
  font-size: var(--lock-font);
  color: var(--fg);
  transform: scaleX(0.9) scaleY(1.3);
  transition: color 0.3s;
}

/* ── LAMP ── */
.block-lamp {
  min-height: calc(200 * var(--u));
  transition: background 0.3s;
}

.lamp-text-wrap {
  position: absolute;
  top: 0; left: 0; bottom: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.block-lamp .proj-title {
  font-size: var(--lamp-font);
  color: var(--block-text);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg) scaleX(1.6) scaleY(0.7);
  white-space: nowrap;
  padding: 0;
  margin: 0;
  letter-spacing: normal;
  transition: color 0.3s;
}

.lamp-bar {
  display: none;
}

/* ── GLIMPO ── */
.block-glimpo {
  width: 100%;
}

.block-glimpo .proj-title {
  font-size: var(--glimpo-font);
  color: var(--fg);
  transform: scaleX(1.9) scaleY(1);
  transition: color 0.3s;
}

/* ── CONFESSION BOX ── */
.block-confession {
  width: 100%;
  transition: background 0.3s;
}

.block-confession .proj-title {
  font-size: var(--confession-font);
  letter-spacing: var(--confession-spacing);
  transform: scaleX(1.0) scaleY(1.0);
  color: var(--block-text);
  transition: color 0.3s;
}

/* ── WEBPAGES ── */
/* Clear like LOCK and GLIMPO, so the rows alternate clear / black.
   Wide and short so it's the smallest block on the page. */
.block-web {
  width: 100%;
  padding-top: calc(8 * var(--u));
}

.block-web .proj-title {
  font-size: var(--web-font);
  color: var(--fg);
  transform: scaleX(var(--web-stretch)) scaleY(1);
  transition: color 0.3s;
}

/* ── FOOTER ── */
footer {
  padding: 10px 24px 14px;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: normal;
  font-family: 'Times New Roman', Times, serif;
  letter-spacing: 0.02em;
  color: var(--fg);
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: transparent;
  opacity: 1;
  transition: none;
}
/* ── PHONES ── */
@media (max-width: 500px) {
  nav { padding: 14px 16px; }
  .nav-left { gap: 12px; }
  .nav-right { gap: 10px; }
  main { padding-left: 16px; padding-right: 16px; }
  :root { --u: min(1px, calc((100vw - 32px) / var(--design-width))); }
  footer { padding: 10px 16px 14px; }
}
