@layer reset, tokens, base, layout, components, motion;

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

  html,
  body {
    margin: 0;
    padding: 0;
  }

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

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

  ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }
}

@layer tokens {
  :root {
    --night: #12150f;
    --ink: #1b2018;
    --bone: #e8dcc8;
    --brass: #c4a574;
    --brass-deep: #8d6e3e;
    --moss: #6e7a58;
    --ash: #9aa094;
    --veil: rgba(10, 13, 9, 0.55);
    --link-bg: rgba(16, 20, 14, 0.62);
    --line: rgba(232, 220, 200, 0.16);
    --sheet: min(24rem, calc(100% - 2.3rem));
    --portrait: clamp(7.25rem, 34vw, 9.25rem);
    --tap: 3.5rem;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --font-display: "Bodoni Moda", "Iowan Old Style", "Palatino Linotype", serif;
    --font-ui: "Saira Condensed", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  }
}

@layer base {
  html {
    background: var(--night);
    color: var(--bone);
    color-scheme: dark;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    min-height: 100dvh;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 1.05rem;
    line-height: 1.35;
    overflow-x: hidden;
    overflow-x: clip;
  }

  ::selection {
    background: color-mix(in srgb, var(--brass) 70%, black);
    color: var(--night);
  }
}

@layer layout {
  .world {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
  }

  .world picture,
  .world img {
    width: 100%;
    height: 100%;
  }

  .world img {
    object-fit: cover;
    object-position: center 30%;
  }

  .world__shade {
    position: absolute;
    inset: 0;
    background:
      linear-gradient(
        180deg,
        rgba(12, 16, 11, 0.28) 0%,
        rgba(12, 16, 11, 0.42) 38%,
        rgba(10, 13, 9, 0.78) 72%,
        rgba(8, 10, 7, 0.92) 100%
      ),
      radial-gradient(120% 70% at 50% 0%, transparent 35%, rgba(8, 10, 7, 0.5) 100%);
  }

  .world__grain {
    position: absolute;
    inset: 0;
    background-image: url("assets/grain.webp");
    background-size: 180px 180px;
    opacity: 0.28;
    mix-blend-mode: overlay;
  }

  .sheet {
    position: relative;
    z-index: 1;
    width: var(--sheet);
    margin-inline: auto;
    min-height: 100dvh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-block: max(1.5rem, calc(env(safe-area-inset-top) + 0.75rem))
      max(1.35rem, calc(env(safe-area-inset-bottom) + 0.85rem));
  }

  .profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    min-width: 0;
    container-type: inline-size;
  }

  .cluster {
    width: 100%;
    min-width: 0;
  }

  .links {
    display: grid;
    gap: 0.62rem;
  }

  .site-foot {
    margin-top: 1.35rem;
    text-align: center;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    color: color-mix(in srgb, var(--ash) 80%, transparent);
  }
}

@layer components {
  .portrait {
    position: relative;
    width: var(--portrait);
    height: var(--portrait);
    margin-bottom: 1.35rem;
  }

  .portrait__frame {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
  }

  .portrait__frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--brass) 70%, white 8%);
    box-shadow:
      0 0 0 6px rgba(12, 16, 11, 0.45),
      0 16px 36px rgba(0, 0, 0, 0.42);
  }

  .portrait__tick {
    position: absolute;
    width: 0.85rem;
    height: 0.85rem;
    border: 1.5px solid var(--brass);
    pointer-events: none;
  }

  .portrait__tick--tl {
    top: -0.28rem;
    left: -0.28rem;
    border-right: 0;
    border-bottom: 0;
  }

  .portrait__tick--tr {
    top: -0.28rem;
    right: -0.28rem;
    border-left: 0;
    border-bottom: 0;
  }

  .portrait__tick--bl {
    bottom: -0.28rem;
    left: -0.28rem;
    border-right: 0;
    border-top: 0;
  }

  .portrait__tick--br {
    bottom: -0.28rem;
    right: -0.28rem;
    border-left: 0;
    border-top: 0;
  }

  .seal {
    position: absolute;
    left: 50%;
    bottom: -0.72rem;
    transform: translateX(-50%);
    width: 2.05rem;
    height: 2.05rem;
    display: grid;
    place-items: center;
    color: var(--brass);
    background: var(--night);
    border: 1px solid var(--brass);
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    z-index: 2;
  }

  .seal svg {
    width: 1.28rem;
    height: 1.28rem;
  }

  .brand {
    margin: 0;
    width: 100%;
    min-width: 0;
    padding-inline: 0.2rem;
    font-family: var(--font-display);
    font-weight: 500;
    font-optical-sizing: none;
    font-size: 1.55rem;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--bone);
    white-space: nowrap;
  }

  .tag {
    margin: 0.55rem 0 0;
    max-width: 16rem;
    font-size: 0.98rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--ash);
  }

  .rule {
    width: 1.7rem;
    height: 1px;
    margin: 1.2rem auto 1.3rem;
    background: var(--brass);
    opacity: 0.75;
    border: 0;
  }

  .link {
    --cut: 0.4rem;
    display: grid;
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.45rem;
    min-height: var(--tap);
    padding: 0.45rem 1.05rem 0.45rem 0.62rem;
    color: var(--bone);
    background: var(--link-bg);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    clip-path: polygon(
      var(--cut) 0,
      calc(100% - var(--cut)) 0,
      100% var(--cut),
      100% calc(100% - var(--cut)),
      calc(100% - var(--cut)) 100%,
      var(--cut) 100%,
      0 calc(100% - var(--cut)),
      0 var(--cut)
    );
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .link__icon {
    width: 2.4rem;
    height: 2.15rem;
    display: grid;
    place-items: center;
    color: var(--brass);
  }

  .link__icon svg {
    width: 1.28rem;
    height: 1.28rem;
  }

  .link__copy {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
  }

  .link__name {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    font-size: 1.12rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.1;
  }

  .link__hint {
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--ash);
  }

  .link__end {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: color-mix(in srgb, var(--bone) 55%, transparent);
  }

  .age {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.18rem 0.38rem 0.12rem;
    border: 1px solid color-mix(in srgb, var(--brass) 70%, transparent);
    color: var(--brass);
    line-height: 1;
  }

  .chevron {
    width: 0.42rem;
    height: 0.42rem;
    border-right: 1.6px solid var(--brass);
    border-top: 1.6px solid var(--brass);
    transform: rotate(45deg);
    opacity: 0.9;
  }

  .link--featured {
    min-height: 3.75rem;
    background: color-mix(in srgb, var(--brass) 14%, rgba(16, 20, 14, 0.72));
    border-color: color-mix(in srgb, var(--brass) 58%, transparent);
  }

  .link--featured .link__name {
    font-size: 1.18rem;
  }

  .link:focus-visible {
    outline: 2px solid var(--brass);
    outline-offset: 3px;
  }

  .link:active {
    transform: scale(0.985);
    background: color-mix(in srgb, var(--ink) 85%, var(--brass));
  }
}

@layer motion {
  @media (hover: hover) and (pointer: fine) {
    .link {
      transition: background 0.2s var(--ease), border-color 0.2s var(--ease),
        transform 0.2s var(--ease);
    }

    .link:hover {
      border-color: color-mix(in srgb, var(--brass) 70%, transparent);
      background: color-mix(in srgb, var(--bone) 9%, var(--link-bg));
    }

    .link--featured:hover {
      background: color-mix(in srgb, var(--brass) 22%, rgba(16, 20, 14, 0.72));
    }
  }

  @media (prefers-reduced-motion: no-preference) {
    .world img {
      animation: world-in 1.15s var(--ease) both;
    }

    .sheet {
      animation: sheet-in 0.8s var(--ease) 0.18s both;
    }
  }
}

@keyframes world-in {
  from {
    opacity: 0;
    transform: scale(1.06);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(0.7rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 360px) {
  :root {
    --tap: 3.35rem;
    --sheet: min(24rem, calc(100% - 1.6rem));
  }

  .link__name {
    font-size: 1.04rem;
  }

  .link {
    --cut: 0.32rem;
    gap: 0.3rem;
    padding-inline: 0.5rem 0.9rem;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
  }

  .link__icon {
    width: 2rem;
  }
}

@media (max-height: 720px) {
  .sheet {
    justify-content: flex-start;
  }

  .portrait {
    margin-bottom: 1.05rem;
  }

  .rule {
    margin-block: 0.95rem 1.05rem;
  }
}

@media (max-height: 620px) {
  :root {
    --portrait: 5.9rem;
    --tap: 3.15rem;
  }

  .tag {
    font-size: 0.88rem;
  }

  .site-foot {
    margin-top: 0.9rem;
  }

  .portrait {
    margin-bottom: 0.85rem;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .sheet {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.4rem;
    width: min(52rem, calc(100% - 2rem));
    padding-inline: max(1rem, env(safe-area-inset-left))
      max(1rem, env(safe-area-inset-right));
  }

  .profile {
    flex: 0 0 13rem;
  }

  .cluster {
    flex: 1 1 18rem;
    max-width: 24rem;
  }

  :root {
    --portrait: 6.6rem;
  }

  .tag {
    display: block;
  }

  .rule {
    display: none;
  }

  .site-foot {
    display: none;
  }
}

@media (min-width: 360px) {
  .brand {
    font-size: 1.8rem;
    letter-spacing: -0.01em;
  }
}

@media (min-width: 390px) {
  .brand {
    font-size: 2.05rem;
    letter-spacing: 0;
  }
}

@media (min-width: 430px) {
  .brand {
    font-size: 2.28rem;
  }
}

@media (min-width: 720px) {
  .brand {
    font-size: 2.55rem;
  }

  .world img {
    object-position: center 40%;
  }

  .world__shade {
    background:
      linear-gradient(
        180deg,
        rgba(12, 16, 11, 0.34) 0%,
        rgba(12, 16, 11, 0.5) 46%,
        rgba(10, 13, 9, 0.82) 100%
      ),
      radial-gradient(90% 70% at 50% 30%, transparent 20%, rgba(8, 10, 7, 0.62) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .world img,
  .sheet,
  .link {
    animation: none;
    transition: none;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .brand {
    font-size: 1.55rem;
    letter-spacing: -0.02em;
    white-space: nowrap;
  }
}

h1.brand {
  font-size: 1.38rem;
  letter-spacing: -0.03em;
}

@media (min-width: 360px) {
  h1.brand {
    font-size: 1.62rem;
    letter-spacing: -0.02em;
  }
}

@media (min-width: 390px) {
  h1.brand {
    font-size: 2.05rem;
    letter-spacing: 0;
  }
}

@media (min-width: 430px) {
  h1.brand {
    font-size: 2.28rem;
  }
}

@media (min-width: 720px) {
  h1.brand {
    font-size: 2.55rem;
    letter-spacing: 0.005em;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  h1.brand {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
  }
}

@layer components {
  html.age-gate-open {
    overflow: hidden;
  }

  .age-gate {
    width: min(26rem, calc(100% - 2rem));
    max-width: none;
    padding: 0;
    color: var(--bone);
    background: transparent;
    border: 0;
    overflow: visible;
  }

  .age-gate::backdrop {
    background: rgba(5, 7, 5, 0.84);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .age-gate__panel {
    --gate-cut: 0.85rem;
    position: relative;
    padding: 2.15rem 1.5rem 1.35rem;
    text-align: center;
    background:
      linear-gradient(145deg, rgba(196, 165, 116, 0.12), transparent 42%),
      rgba(15, 19, 13, 0.97);
    border: 1px solid color-mix(in srgb, var(--brass) 68%, transparent);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.68);
    clip-path: polygon(
      var(--gate-cut) 0,
      calc(100% - var(--gate-cut)) 0,
      100% var(--gate-cut),
      100% calc(100% - var(--gate-cut)),
      calc(100% - var(--gate-cut)) 100%,
      var(--gate-cut) 100%,
      0 calc(100% - var(--gate-cut)),
      0 var(--gate-cut)
    );
  }

  .age-gate__mark {
    width: 3.3rem;
    height: 3.3rem;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    color: var(--brass);
    background: var(--night);
    border: 1px solid var(--brass);
    border-radius: 50%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.55);
  }

  .age-gate__mark svg {
    width: 1.8rem;
    height: 1.8rem;
  }

  .age-gate__eyebrow {
    margin: 0 0 0.5rem;
    color: var(--brass);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
  }

  .age-gate__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.65rem, 7vw, 2.15rem);
    font-weight: 500;
    line-height: 1.08;
  }

  .age-gate__description {
    max-width: 19rem;
    margin: 0.8rem auto 1.35rem;
    color: var(--ash);
    font-size: 1rem;
    line-height: 1.4;
  }

  .age-gate__description span {
    color: var(--bone);
  }

  .age-gate__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .age-gate__button {
    min-height: 3.2rem;
    padding: 0.65rem 0.75rem;
    color: var(--bone);
    font: 600 1rem/1.1 var(--font-ui);
    letter-spacing: 0.035em;
    background: rgba(22, 27, 19, 0.9);
    border: 1px solid var(--line);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .age-gate__button--confirm {
    color: var(--night);
    background: var(--brass);
    border-color: var(--brass);
  }

  .age-gate__button:focus-visible {
    outline: 2px solid var(--bone);
    outline-offset: 3px;
  }

  .age-gate__button:active {
    transform: scale(0.98);
  }

  .age-gate__note {
    margin: 1rem 0 0;
    color: color-mix(in srgb, var(--ash) 75%, transparent);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
  }
}

@media (max-width: 380px) {
  .age-gate {
    width: calc(100% - 1.2rem);
  }

  .age-gate__panel {
    padding-inline: 1rem;
  }

  .age-gate__actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .age-gate[open] .age-gate__panel {
    animation: age-gate-in 0.28s var(--ease) both;
  }
}

@keyframes age-gate-in {
  from {
    opacity: 0;
    transform: translateY(0.75rem) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
