/* kemer.dev
 * Aesthetic anchor: "circuit astrolabe" — retrofuturist near-black, but engraved
 * instead of neon: hairline outline traces, annular vias, 45deg chamfers, zero glow.
 * One dominant (near-black) + one accent (teal). Mint is ink, never a third accent.
 *
 * Measured contrast on #0F0F0F:
 *   teal  #01A189            5.90:1  -> AA for text, ONLY at full opacity
 *   mint  #C2F8DA           16.19:1
 *   mint  #C2F8DA @ .72      ~8.6:1  -> secondary text
 *   teal  #01A189 @ .80      4.15:1  -> FAILS. Never fade teal text.
 */

:root {
  --void:        #0F0F0F;   /* dominant */
  --teal:        #01A189;   /* accent, sparingly */
  --mint:        #C2F8DA;   /* ink */
  --ink:         var(--mint);
  --ink-soft:    rgba(194, 248, 218, .72);
  --ink-faint:   rgba(194, 248, 218, .40);   /* decoration only, never text */
  --trace:       rgba(194, 248, 218, .55);
  --hairline:    .9;

  --font-body: 'Ubuntu', 'Ubuntu Sans', 'DejaVu Sans', system-ui, sans-serif;
  --font-tech: 'Ubuntu Condensed', 'Ubuntu Sans Condensed', 'Roboto Condensed',
               'Arial Narrow', var(--font-body);

  /* 8px spacing grid */
  --s1: 8px;  --s2: 16px;  --s3: 24px;  --s4: 32px;  --s6: 48px;  --s8: 64px;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --sigil-size: min(58vmin, 460px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Faint vignette so the emblem sits in space rather than on a flat sheet. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 46%,
              rgba(1, 161, 137, .07) 0%,
              rgba(1, 161, 137, .02) 34%,
              transparent 62%);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: var(--s2) var(--s3);
  background: var(--teal);
  color: var(--void);
  font-family: var(--font-tech);
  text-transform: uppercase;
  letter-spacing: .08em;
  text-decoration: none;
}
.skip:focus { left: var(--s2); top: var(--s2); }

/* ---------------------------------------------------------------- stage -- */

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

/* Core and doors share the single grid cell: the doors nav has no height of its
   own (its links are absolutely placed), but as a second grid row it still took
   half the free space and pushed the spiral ~90px above centre. */
.stage > * { grid-area: 1 / 1; }

.core {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  transition: transform .9s var(--ease);
  will-change: transform;
}

/* --------------------------------------------------------------- sigil --- */

.sigil {
  position: relative;
  width: var(--sigil-size);
  height: var(--sigil-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.sigil__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;          /* the arms grow past the button when it opens */
  pointer-events: none;       /* the button itself is the hit target */
}

.sigil circle,
.sigil path,
.sigil line { fill: none; }

/* transform-box: view-box + origin 50% 50% puts the rotation centre on the
   viewBox centre, which is user-space (0,0) — where the spiral is generated. */
.sigil__arms,
.sigil__rings {
  transform-box: view-box;
  transform-origin: 50% 50%;
  will-change: transform, opacity;
}

.sigil__arms path {
  stroke: var(--trace);
  stroke-width: var(--hairline);
  vector-effect: non-scaling-stroke;
  transition: stroke .5s var(--ease);
}
.sigil__arms .pad {
  stroke: var(--teal);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}
.sigil__arms .pad--plate { fill: var(--void); }
.sigil__arms .via        { fill: var(--teal); stroke: none; }
.sigil__arms .node {
  stroke: var(--ink-faint);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.ring {
  stroke: var(--teal);
  vector-effect: non-scaling-stroke;
}
.ring--tick  { stroke-width: 1.4; stroke-dasharray: 2 15; opacity: .55; }
.ring--faint { stroke-width: 1;   stroke-dasharray: 1 9;  opacity: .30; }
.ring__marks line {
  stroke: var(--ink-faint);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.hub__plate { fill: var(--void); stroke: var(--teal); stroke-width: 1.6;
              vector-effect: non-scaling-stroke; }
.hub__via   { fill: var(--teal); }

/* Once the spiral expands, the bare hub reads as a stray dot; the halo keeps
   the centre reading as a deliberate mark (and as the "close" affordance). */
.hub__halo {
  stroke: var(--teal);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0;
  transition: opacity .7s var(--ease);
}
.js:not(.is-closed) .hub__halo { opacity: .55; }

/* `is-live` is set by the same JS flag that drives the spin, so pointing at the
   sigil and tabbing to it brighten the traces identically. The :hover rule is
   the no-JS fallback. */
.sigil:hover .sigil__arms path,
.sigil.is-live .sigil__arms path { stroke: rgba(194, 248, 218, .85); }

.sigil__hint {
  position: absolute;
  left: 50%;
  bottom: -6px;
  transform: translateX(-50%);
  font-family: var(--font-tech);
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--teal);
  white-space: nowrap;
  transition: opacity .4s var(--ease);
}

.sigil:focus { outline: none; }
.sigil:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 6px;
}

/* --------------------------------------------------------------- names --- */

.wordmark {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 4.6vmin, 44px);
  font-weight: 300;
  letter-spacing: .30em;
  text-indent: .30em;          /* balances the trailing letter-space */
  text-transform: uppercase;
  color: var(--ink);
}

.role {
  margin: 0;
  max-width: min(780px, 88vw);
  text-align: center;
  font-family: var(--font-tech);
  font-size: clamp(12px, 1.7vmin, 15px);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.role span { color: var(--teal); padding: 0 .35em; }

/* Secondary link under the role line: "Sobre" lost its corner when Consultoria
   took the third door, so it rides with the wordmark and fades with the doors. */

.aside { margin: 0; }

.aside__link {
  font-family: var(--font-tech);
  font-size: 11px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .35s var(--ease), opacity .6s var(--ease);
}
.aside__link:hover { border-color: var(--teal); }
.aside__link:focus { outline: none; }
.aside__link:focus-visible { outline: 2px solid var(--teal); outline-offset: 6px; }


.panel__inline {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--teal);
}
.panel__inline:hover { color: #fff; }

/* Identity block: hidden while the spiral is closed so the emblem stands alone
   and sits dead centre; revealed in a cascade when it opens. Absolutely placed
   under the sigil so hiding it does not shift the spiral. Only JS adds
   .is-closed, so without JS the name is always visible. */

.core { position: relative; }

.ident {
  position: absolute;
  top: calc(100% + var(--s3));
  left: 50%;
  width: max-content;
  max-width: 92vw;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
}

.is-closed .ident > * { opacity: 0; pointer-events: none; }

/* Reveal is a keyframe animation (not a transition) so it also plays when the
   block comes back from display:none on narrow screens. */
.js:not(.is-closed) .ident > * { animation: ident-rise 1.1s var(--ease) both; }
.js:not(.is-closed) .ident .wordmark {
  animation: ident-rise 1.1s var(--ease) .35s both, ident-track 1.6s var(--ease) .35s both;
}
.js:not(.is-closed) .ident .role  { animation-delay: .75s; }
.js:not(.is-closed) .ident .aside { animation-delay: 1.1s; }

@keyframes ident-rise {
  from { opacity: 0; transform: translateY(12px); filter: blur(3px); }
  to   { opacity: 1; transform: none;             filter: none; }
}
@keyframes ident-track {
  from { letter-spacing: .62em; text-indent: .62em; }
  to   { letter-spacing: .30em; text-indent: .30em; }
}

/* --------------------------------------------------------------- doors --- */

.doors { position: static; }

.door {
  position: absolute;
  display: block;
  max-width: 30ch;
  text-decoration: none;
  color: var(--ink);
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}

.door__meta {
  display: block;
  font-family: var(--font-tech);
  font-size: 11px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 6px;
}

.door__label {
  display: block;
  font-size: clamp(16px, 2.4vmin, 22px);
  font-weight: 400;
  letter-spacing: .02em;
  line-height: 1.2;
  border-bottom: 1px solid rgba(1, 161, 137, .45);
  padding-bottom: 6px;
  transition: border-color .35s var(--ease), color .35s var(--ease);
}

.door:hover .door__label,
.door:focus-visible .door__label { border-color: var(--teal); color: #fff; }

.door:focus { outline: none; }
.door:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 8px;
}

.door--tl { top: 5vh; left:  5vw; text-align: left;  }
.door--tr { top: 5vh; right: 5vw; text-align: right; }
.door--bl { bottom: 5vh; left:  5vw; text-align: left;  }
.door--br { bottom: 5vh; right: 5vw; text-align: right; }

/* Closed state — only added by JS, so no-JS keeps everything open. */
.is-closed .door { opacity: 0; pointer-events: none; }
.is-closed .door--tl { transform: translate(34px,  26px); }
.is-closed .door--tr { transform: translate(-34px, 26px); }
.is-closed .door--bl { transform: translate(34px,  -26px); }
.is-closed .door--br { transform: translate(-34px, -26px); }

.js:not(.is-closed) .sigil__hint { opacity: 0; }
.js:not(.is-closed) .core        { transform: scale(.92); }
.js .sigil__hint                 { opacity: 0; transition: opacity 1.4s var(--ease); }
/* The hint only earns its place after 5s of idleness (js/spiral.js). */
.js.is-closed .sigil.hint-on .sigil__hint { opacity: 1; }

/* Idle nudge: two heartbeats with a blink, played right before the hint. */
.sigil.is-pulsing .sigil__svg {
  animation: sigil-pulse 1.2s var(--ease) 2;
  transform-origin: 50% 50%;
}
@keyframes sigil-pulse {
  0%   { transform: scale(1);     filter: brightness(1);   opacity: 1;   }
  22%  { transform: scale(1.045); filter: brightness(1.9); opacity: 1;   }
  42%  { transform: scale(1.01);  filter: brightness(1);   opacity: .45; }
  62%  { transform: scale(1.025); filter: brightness(1.5); opacity: 1;   }
  100% { transform: scale(1);     filter: brightness(1);   opacity: 1;   }
}

/* -------------------------------------------------------------- panels --- */

.panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .35s var(--ease), visibility .35s;
}
.panel:target,
.panel.is-open { opacity: 1; visibility: visible; }
.panel__sheet:focus { outline: none; }
.panel__sheet:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }

.panel__veil {
  position: absolute;
  inset: 0;
  background: rgba(9, 9, 9, .93);
  backdrop-filter: blur(3px);
}

.panel__sheet {
  position: relative;
  width: min(58ch, calc(100vw - var(--s6)));
  max-height: calc(100vh - var(--s8));
  overflow-y: auto;
  padding: var(--s6);
  border: 1px solid rgba(1, 161, 137, .38);
  background: var(--void);
  font-size: clamp(15px, 2vmin, 17px);
  line-height: 1.75;
  color: var(--ink-soft);
}
.panel__sheet p { margin: 0 0 var(--s2); }
.panel__sheet strong { color: var(--ink); font-weight: 500; }

.panel__title {
  margin: 0 0 var(--s3);
  font-family: var(--font-tech);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .30em;
  text-transform: uppercase;
  color: var(--teal);
}

.panel__mail {
  color: var(--ink);
  font-size: 1.1em;
  text-decoration: none;
  border-bottom: 1px solid var(--teal);
  word-break: break-all;
}
.panel__mail:hover { color: #fff; }

.panel__close {
  display: inline-block;
  margin-top: var(--s3);
  font-family: var(--font-tech);
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.panel__close:hover { border-color: var(--teal); }

.panel__sheet--links { width: min(34ch, calc(100vw - var(--s6))); }

.links { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.links__item {
  display: block;
  color: var(--ink);
  font-size: clamp(18px, 2.6vmin, 22px);
  font-weight: 400;
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(1, 161, 137, .45);
  transition: border-color .35s var(--ease), color .35s var(--ease);
}
.links__item::after { content: " \2197"; color: var(--teal); font-size: .8em; }
.links__item--mail::after { content: none; }
.links__item--mail { word-break: break-all; }
.links__item:hover { color: #fff; border-color: var(--teal); }

.panel a:focus { outline: none; }
.panel a:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }

/* ------------------------------------------------------------- narrow ---- */
/* Corners do not exist on a phone. Deliberate column variant instead. */

@media (max-width: 760px), (max-height: 520px) {
  :root { --sigil-size: min(46vmin, 260px); }

  body { overflow-y: auto; }

  .stage {
    position: static;
    display: block;
    min-height: 100%;
    padding: var(--s6) var(--s4) var(--s8);
  }

  .core { gap: var(--s3); }
  .core, .js:not(.is-closed) .core { transform: none; }
  .ident { position: static; transform: none; width: auto; max-width: none; }

  .is-closed .ident,
  .is-closed .doors { display: none; }
  .is-closed .stage {
    display: grid;
    place-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--s4);
  }

  .js:not(.is-closed) .door { animation: ident-rise 1s var(--ease) both; }
  .js:not(.is-closed) .door:nth-child(1) { animation-delay: 1.3s; }
  .js:not(.is-closed) .door:nth-child(2) { animation-delay: 1.45s; }
  .js:not(.is-closed) .door:nth-child(3) { animation-delay: 1.6s; }
  .js:not(.is-closed) .door:nth-child(4) { animation-delay: 1.75s; }

  .doors {
    display: flex;
    flex-direction: column;
    gap: var(--s3);
    margin: var(--s8) auto 0;
    width: min(38ch, 100%);
  }

  .door {
    position: static;
    max-width: none;
    text-align: left;
  }
  .door--tr, .door--br { text-align: left; }

  .is-closed .door--tl,
  .is-closed .door--tr,
  .is-closed .door--bl,
  .is-closed .door--br { transform: translateY(14px); }

  .sigil__hint { bottom: -18px; }
  .panel__sheet { padding: var(--s4) var(--s3); }
}

/* ------------------------------------------------------------ reduced ---- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .sigil__hint { display: none; }
  .sigil { cursor: default; }
}
