@import url("workspace.css");

:root {
  --paper: #f1ecdf;
  --paper-deep: #e5dccb;
  --cream: #fffaf0;
  --ink: #1a211b;
  --muted: #616a61;
  --forest: #18251d;
  --night: #101712;
  --wood: #896342;
  --gold: #ad8555;
  --sage: #a9b69f;
  --line: rgba(26, 33, 27, .15);
  --light: rgba(255, 250, 240, .16);
  --display: Georgia, "Times New Roman", serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--night); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  line-height: 1.5;
}
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
img { display: block; }
[hidden] { display: none !important; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.topbar {
  position: fixed;
  z-index: 80;
  inset: 0 0 auto;
  min-height: 66px;
  padding: 0 clamp(16px, 4vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--cream);
  background: rgba(16, 23, 18, .93);
  border-bottom: 1px solid var(--light);
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
}
.brand img { filter: brightness(0) invert(1); }
.local, .prototype {
  padding: 6px 9px;
  border: 1px solid var(--light);
  border-radius: 999px;
  color: rgba(255, 250, 240, .62);
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .04em;
}
.screen { min-height: 100vh; padding-top: 66px; }
.eyebrow {
  margin: 0 0 10px;
  color: #737d71;
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.intro {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding-inline: clamp(22px, 8vw, 130px);
  color: var(--cream);
  background:
    radial-gradient(circle at 78% 44%, rgba(151, 174, 145, .19), transparent 26%),
    radial-gradient(circle at 13% 88%, rgba(171, 127, 83, .16), transparent 30%),
    var(--night);
}
.intro-copy {
  position: relative;
  z-index: 3;
  width: min(790px, 100%);
  margin-right: min(29vw, 410px);
}
.intro .eyebrow { color: rgba(255, 250, 240, .5); }
.intro h1, .problem h1, .library h1 {
  margin: 0 0 24px;
  font-family: var(--display);
  font-size: clamp(3.2rem, 7vw, 7rem);
  line-height: .94;
  font-weight: 400;
  letter-spacing: -.052em;
}
.lead {
  max-width: 720px;
  margin: 0 0 32px;
  color: rgba(255, 250, 240, .74);
  font-size: clamp(1.03rem, 1.6vw, 1.25rem);
}
.rules {
  max-width: 680px;
  margin-bottom: 30px;
  border-top: 1px solid var(--light);
}
.rules p {
  margin: 0;
  padding: 13px 0;
  border-bottom: 1px solid var(--light);
  color: rgba(255, 250, 240, .67);
}
.rules b { color: var(--cream); }
.intro small {
  display: block;
  max-width: 610px;
  margin-top: 17px;
  color: rgba(255, 250, 240, .38);
}
.hex-intro {
  position: absolute;
  right: clamp(-150px, -5vw, -40px);
  top: 50%;
  width: 650px;
  height: 620px;
  transform: translateY(-50%);
}
.hex-intro i, .hex-intro b {
  position: absolute;
  width: 210px;
  height: 182px;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  border: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.015)),
    rgba(134, 159, 132, .13);
  filter: drop-shadow(0 18px 35px rgba(0,0,0,.14));
}
.hex-intro i:nth-child(1) { left: 220px; top: 33px; }
.hex-intro i:nth-child(2) { left: 60px; top: 126px; background-color: rgba(176, 134, 86, .13); }
.hex-intro i:nth-child(3) { left: 380px; top: 126px; background-color: rgba(128, 157, 161, .12); }
.hex-intro i:nth-child(4) { left: 60px; top: 312px; background-color: rgba(182, 172, 132, .12); }
.hex-intro i:nth-child(5) { left: 380px; top: 312px; background-color: rgba(139, 160, 119, .13); }
.hex-intro i:nth-child(6) { left: 220px; top: 405px; background-color: rgba(155, 115, 88, .12); }
.hex-intro b {
  left: 220px;
  top: 219px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,250,240,.3), transparent 5%),
    linear-gradient(145deg, rgba(177,138,93,.45), rgba(47,72,52,.5));
  box-shadow: inset 0 0 0 1px rgba(255,250,240,.22);
}

.primary, .secondary, .danger, .link, .back-link {
  min-height: 44px;
  border-radius: 10px;
  font-weight: 760;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.primary {
  padding: 11px 18px;
  border: 1px solid var(--cream);
  color: var(--forest);
  background: var(--cream);
}
.primary:hover { transform: translateY(-1px); background: #fff; }
.secondary {
  padding: 9px 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, .42);
}
.secondary:hover { background: rgba(255, 255, 255, .7); }
.danger {
  padding: 9px 14px;
  border: 1px solid rgba(134, 70, 59, .25);
  color: #80453c;
  background: rgba(255, 255, 255, .3);
}
.link, .back-link {
  padding: 8px 2px;
  border: 0;
  color: var(--wood);
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.actions { display: flex; align-items: center; gap: 9px; }

.library {
  padding-inline: clamp(18px, 5vw, 70px);
  background: linear-gradient(150deg, var(--paper), var(--paper-deep));
}
.library-shell { width: min(1260px, 100%); margin: auto; padding: clamp(60px, 9vw, 120px) 0; }
.library-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 38px;
}
.library h1 { font-size: clamp(3.2rem, 7vw, 6.5rem); }
.library-head p:not(.eyebrow) { max-width: 640px; color: var(--muted); }
.atlas-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.atlas-card {
  position: relative;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 83% 24%, rgba(135, 157, 128, .22), transparent 22%),
    radial-gradient(circle at 73% 65%, rgba(178, 135, 87, .13), transparent 18%),
    rgba(255, 252, 247, .74);
  box-shadow: 0 18px 55px rgba(31, 35, 29, .08);
  overflow: hidden;
}
.atlas-card::after {
  content: "";
  position: absolute;
  right: 38px;
  bottom: 28px;
  width: 120px;
  height: 105px;
  opacity: .18;
  pointer-events: none;
  background:
    linear-gradient(30deg, transparent 48%, rgba(34,48,37,.6) 49% 51%, transparent 52%),
    linear-gradient(-30deg, transparent 48%, rgba(34,48,37,.6) 49% 51%, transparent 52%);
  clip-path: polygon(25% 0,75% 0,100% 50%,75% 100%,25% 100%,0 50%);
}
.atlas-card-open {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  padding: 30px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.atlas-card-open small, .atlas-card-open span {
  display: block;
  color: #737c72;
  font-size: .68rem;
  font-weight: 760;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.atlas-card-open strong {
  display: block;
  margin: 50px 0 12px;
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1;
  font-weight: 400;
}
.atlas-card-open p {
  display: -webkit-box;
  max-width: 620px;
  margin: 0 0 24px;
  color: var(--muted);
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.atlas-card-delete {
  position: absolute;
  z-index: 4;
  right: 15px;
  top: 15px;
  padding: 7px 10px;
  border: 1px solid rgba(134, 70, 59, .18);
  border-radius: 999px;
  color: #855148;
  background: rgba(255, 255, 255, .5);
  font-size: .7rem;
}
.empty-library {
  max-width: 780px;
  padding: clamp(32px, 6vw, 70px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 252, 247, .65);
}
.empty-library h2 {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: 1;
  font-weight: 400;
}
.empty-library p:not(.eyebrow) { color: var(--muted); }

.problem {
  display: grid;
  place-items: center;
  padding-inline: 18px;
  background: linear-gradient(150deg, var(--paper), var(--paper-deep));
}
.problem-card {
  width: min(900px, 100%);
  padding: clamp(28px, 6vw, 70px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 252, 246, .72);
  box-shadow: 0 28px 90px rgba(24, 29, 23, .14);
}
.problem h1 { font-size: clamp(3rem, 7vw, 6.3rem); color: var(--ink); }
.problem-card > p:not(.eyebrow) { max-width: 700px; color: var(--muted); }
.problem label, dialog label {
  display: block;
  margin: 22px 0 7px;
  font-size: .72rem;
  font-weight: 820;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.problem textarea, .composer textarea, dialog textarea, dialog input, dialog select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, .74);
  outline: 0;
}
.problem textarea {
  min-height: 220px;
  padding: 17px;
  resize: vertical;
  font-size: 1.04rem;
  line-height: 1.58;
}
.problem textarea:focus, .composer textarea:focus, dialog textarea:focus, dialog input:focus, dialog select:focus {
  border-color: var(--wood);
  box-shadow: 0 0 0 3px rgba(139, 101, 69, .12);
}
.problem .actions { justify-content: space-between; margin-top: 14px; }

@media (max-width: 900px) {
  .intro-copy { margin-right: 0; }
  .hex-intro { right: -330px; opacity: .55; }
  .library-head { align-items: stretch; flex-direction: column; }
  .atlas-list { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .topbar { min-height: 60px; padding-inline: 13px; }
  .local { display: none; }
  .screen { padding-top: 60px; }
  .intro { align-items: end; padding: 96px 20px 38px; }
  .intro h1 { font-size: clamp(3rem, 14vw, 4.8rem); }
  .hex-intro { width: 600px; right: -410px; top: 28%; opacity: .4; }
  .library { padding-inline: 10px; }
  .library-shell { padding: 45px 0; }
  .library-head { padding-inline: 8px; }
  .library h1 { font-size: 3.5rem; }
  .atlas-card-open { padding: 22px; }
  .atlas-card-open strong { margin-top: 42px; }
  .problem { padding-inline: 10px; }
  .problem-card { padding: 27px 19px; border-radius: 20px; }
  .problem .actions { align-items: stretch; flex-direction: column-reverse; }
  .problem .primary { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
