/* Global */

:root {
  --bg: #fbfbfb;
  --panel-bg: #ffffff;
  --border-soft: #e1e1e1;
  --border-strong: #c2c2c2;
  --text-main: #222222;
  --text-soft: #777777;
}

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

@font-face {
  font-family: "Funnel Sans";
  src:
    url("./fonts/FunnelSans-VariableFont_wght.woff2") format("woff2");
  font-weight: 500;
  /* 400 Regular, 500 Medium, 600 Semibold*/
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src:
    url("./fonts/geist-v5-latin-regular.woff2") format("woff2");
  font-weight: 500, 600, 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src:
    url("./fonts/geist-mono-v5-latin-regular.woff2") format("woff2");
  font-weight: 400, 500, 600;
  font-style: normal;
  font-display: swap;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-main);
  font-family: "Funnel Sans", Arial, Courier, -apple-system, "Helvetica Neue",
    system-ui, sans-serif;
  font-size: 11px;
}

/* Centered layout */

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  /* flex-start;*/
  justify-content: center;

}

.shell {
  width: 100%;
  max-width: 720px;
  margin: 0px 20px 50px;
  /* text-align: center; */
}

/* Header */

header {
  text-align: center;
  margin-bottom: 20px;
  /* align-items: center; */
  justify-content: center;
}

header h1 {
  font-family: "Funnel Sans", Arial, Courier;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 4px;
}

header .tagline {
  margin: 0;
  font-size: 10px;
  color: var(--text-soft);
}

/* Panels – no lift/glow - old */

/* .panel {
  background: var(--panel-bg);
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  padding: 16px 18px 18px;
  margin-top: 14px;
}

.panel + .panel {
  margin-top: 10px;
} */

/* ── Panels ──────────────────────────────────── */

.panel {
  background: transparent;
  /* border: 1px dotted var(--border-soft); */
  border-radius: 0;
  padding: 16px 18px 18px;
  margin-top: 0;
  position: relative;
  justify-content: center;
}

/* ASCII corner chars */
.panel::before {
  content: "+";
  position: absolute;
  top: -1px;
  left: -1px;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--border-strong);
  line-height: 1;
  background: var(--bg);
  padding: 0 1px;
}

.panel::after {
  content: "+";
  position: absolute;
  top: -1px;
  right: -1px;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--border-strong);
  line-height: 1;
  background: var(--bg);
  padding: 0 1px;
}

.panel+.panel {
  margin-top: -1px;
  /* share the border */
}

/* Labels + inputs */

label {
  display: block;
  font-size: 10px;
  font-family: "Geist Mono", "Funnel Sans", Arial;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  margin-bottom: 4px;
}

#sentenceInput {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: #fcfcfc;
  padding: 6px 8px;
  font-family: "Geist Mono", "Funnel Sans", Arial, Courier, sans-serif;
  font-size: 12px;
  /* small input text */
  color: var(--text-main);
  outline: none;
  height: 70px;
  resize: none;
  /* vertical;*/
}

::placeholder {
  /* color: #ff0000; */
  font-family: "Geist Mono", Arial, Courier, sans-serif;
  opacity: .4;
  /* Required for Firefox to remove default transparency */
}

/* initials under input */

#nameInput {
  width: 100%;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: #fcfcfc;
  padding: 5px 8px;
  font-family: "Geist Mono", "Funnel Sans", Arial, Courier, sans-serif;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  margin-top: 8px;
}

/* Buttons */

button {
  /* border-radius: 10px;
  corner-shape: bevel; */
  border: 0px solid var(--border-soft);
  background: #f9f9f9;
  padding: 6px 16px;
  font-family: "Geist Mono", "Funnel Sans", monospace, Arial;
  font-size: 11px;
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0px;
  transition: background 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease, box-shadow 0.15s ease;
  position: relative;
  /* overflow: hidden; */
}

/* button::before {
  content: "";
  position: absolute;
  inset: 0;
  text-decoration: none;
  border-radius: inherit;
  padding: 1px;
  background: transparent;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
} */

button:hover {
  /* background: #f1f1f1; */
  border-color: transparent;

}

/* button:hover::before {
  opacity: 1;
  background-image: linear-gradient(
    90deg,
    #ff8f8f,
    #ffcc7f,
    #95e284,
    #7fb6ff,
    #c59bff,
    #ff8f8f
  );
  background-size: 200% 100%;
  animation: rainbow-border 3s linear infinite;
} */


button:active {
  transform: translateY(0);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
}

.buttons-row {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  /* border: black solid 1px; */
}

/* Space above the sentence label */
label[for="sentenceInput"] {
  margin-top: 10px;
}

/* Extra space above the Expand sentence button */
#breakdownButton {
  margin-top: 10px;
  display: flex;
  width: 70px;
  justify-content: center;
  border: black solid 1px;
  transition: width 2s, border 2s;
}

#breakdownButton:hover {
  /* background: #f1f1f1; */
  width: 680px;
  transition: width 8s, border 1s;
  /* border: 1px solid transparent; */
}

#breakdownButton:disabled {
  opacity: 0.35;
  cursor: default;
  border: 1px solid transparent;
  pointer-events: none;
  transition: border 1s;
}

#poemButton {
  margin-top: 25px;
  /* border: red solid 1px; */
}

/* Section titles */

.panel h2 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
  margin: 0 0 10px;
}

/* Word list – container */

#wordList {
  border-radius: 7px;
  border: 1px dashed var(--border-soft);
  padding: 12px;
  min-height: 50px;
  font-family: "Funnel Sans", Arial;
  /* background: #fdfdfd; */
}

/* Words: small label + big definition */

.word {
  cursor: pointer;
  margin: 4px 4px;
  padding: 4px 6px 6px;
  /* border: 1px solid transparent; */
  display: inline-block;
  transition: color 0.3s ease;
}

/* small, soft label above */
.original-word {
  font-family: "Geist Mono", monospace, Arial;
  font-size: 10px;
  color: var(--text-soft);
  display: block;
  margin-bottom: 2px;
}

.punctuation {
  cursor: default;
  user-select: none;
  font-family: "Funnel Sans", Arial, sans-serif;
  font-size: 22px;
  line-height: 1.25;
}

/* big, primary text */
.definition {
  display: block;
  font-family: "Funnel Sans", monospace, Arial;
  font-size: 22px;
  /* focus: way bigger */
  line-height: 1.25;
  color: var(--text-main);
  animation: fade-in 0.3s ease;
}

.definition::selection {
  background: transparent;
  border: red solid 1px;
}

.word {
  font-family: "Funnel Sans", "Geist Mono";
  font-size: 22px;
  line-height: 1.25;
}

/* fallback when there's no .definition span */
.word:not(:has(.definition)) {
  font-size: 22px;
}

/* hover: just a quiet outline */
.word:hover {
  box-sizing: border-box;
  /* border-bottom: 1px solid var(--border-soft); */
  background: transparent;
  background: #fffac0;
}

.defined {
  color: var(--text-main);
}

.undefined {
  color: #aaaaaa;
}

/* Messages */

#errorMessage {
  color: #b44a4a;
  margin-top: 8px;
  font-size: 10px;
}

#popupMessage {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333333;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 10px;
  display: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

/* Rainbow animation */

/* @keyframes rainbow-border {
  0% {
    background-position-x: 0%;
  }
  100% {
    background-position-x: 200%;
  }
} */

.btn-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}

.btn-border-line {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  line-height: 1;
  color: var(--text-main);
  display: block;
  white-space: nowrap;
  letter-spacing: 0;
}

.btn-border-line .ascii-border-char {
  display: inline-block;
  position: relative;
  transition: transform 0.3s cubic-bezier(0, 1.2, 1, 1);
}

.btn-border-line .ascii-border-char::after {
  content: "";
  position: absolute;
  inset: -6px -3px;
}

.btn-border-line .ascii-border-char.nudged {
  transform: var(--nudge);
  transition: transform 0.05s ease-out;
}

/* .btn-wrap:hover .ascii-border-char {
  transform: var(--nudge);
  transition: transform 0.05s ease-out;
} */

.def-to {
  cursor: pointer;
  /* opacity: 0.5; */
  text-decoration: underline dotted var(--border-soft);
  text-underline-offset: 7px;
  background: transparent;
}

.def-to.hidden {
  text-decoration: line-through;
  opacity: 0.25;
  background: transparent;
}

/* About link */

/* About overlay */
.about-box {
  background: var(--panel-bg);
  border-radius: 0;
  border: 1px solid var(--border-strong);
  padding: 20px 18px 18px;
  max-width: 380px;
  width: calc(100% - 48px);
  font-family: "Funnel Sans", Arial;
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.about-box::before {
  /* content: "+ - - - - - - - - - - - - - - - - - +"; */
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--border-strong);
  white-space: nowrap;
  overflow: hidden;
  align-self: stretch;
}

.about-box h2 {
  margin: 0;
  padding-top: 5px;
  padding-bottom: 10px;
  font-size: 10px;
  font-family: "Geist Mono", "Funnel Sans", Arial;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  align-self: stretch;
  text-align: center;
}

.about-box p {
  margin: 0;
  line-height: 1.4;
  color: var(--text-main);
  align-self: stretch;
  text-align: center;
}

.comment {
  padding-top: 8px;
  /* font-size: 10px; */
  /* font-family: "Geist Mono"; */
  color: #aaaaaa;
}

.about-close {
  margin-top: 25px;
  float: none;
  align-self: center;
  background: transparent;
}

.about-close:hover {
  background: transparent;
}

.about-overlay {
  position: fixed;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.05);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.collection-link {
  text-align: center;
}

.collection-link a {
  color: var(--text-main);
  text-decoration: none;
}

.collection-link a:hover {
  color: #444444;
}


/* ascii character anim */

.ascii-char {
  display: inline-block;
  position: relative;
  transition: transform 0.35s cubic-bezier(0, 1.2, 1, 1);
}

/* animation coming back */
/* .ascii-char {
  display: inline-block;
  position: relative;
  transition: transform 1.2s cubic-bezier(0,1.2,1,1);  (plots x1 [btwn 0,1], y1, x2 [btwn 0,1], y2) 
} */

.ascii-char::after {
  content: "";
  position: absolute;
  inset: -4px -4px;
  /* expand hit area without affecting layout - y x */
}

.ascii-char.nudged {
  transform: var(--nudge);
  /* animation going out */
  /* transition: transform .6s ease-in-out; */
}

/* ── Mobile ──────────────────────────────────── */

@media (max-width: 600px) {

  /* viewport meta is required — gotta add to index.html head */

  html, body {
    overflow-x: hidden;
  }

  .shell {
    margin: 16px 12px 40px;
  }

  /* scale down ASCII art to fit narrow screen */
  header h1 pre {
    font-size: 9px;
    line-height: 1.25;
    overflow-x: hidden;
    text-align: left;
    display: inline-block;
    letter-spacing: 0;
  }

  header {
    overflow: hidden;
    text-align: center;
  }

  /* word list bigger touch targets */
  .word {
    padding: 6px 8px 8px;
    margin: 3px;
  }

  .definition,
  .word,
  .word:not(:has(.definition)),
  .punctuation {
    font-size: 18px;
  }

  /* expand button — disable the width animation on mobile, just full width */
  #breakdownButton {
    width: 100%;
    transition: none;
  }

  #breakdownButton:hover {
    width: 450%;
    transition: none;
  }

  /* poem button full width too */
  #poemButton {
    width: 100%;
  }

  .buttons-row {
    gap: 6px;
  }

  /* about box full width */
  .about-box {
    width: calc(100% - 24px);
    padding: 16px 14px;
  }

}