/* GhiChu.xyz vNext — responsive editor, sharing modes, and public pages */

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.header-inner,
.main-content,
.editor-container,
.editor-layout,
.editor-text-wrap,
.toolbar,
.toolbar-inner,
.tool-left,
.seo-box,
.info-box,
.tfa-box {
  min-width: 0;
}

.mob-toggle svg {
  display: block;
  width: 22px;
  height: 22px;
}

.editor-layout,
html.ios26 .editor-layout {
  width: 100%;
}

.editor-text-wrap {
  width: 100%;
}

#note-content,
html.ios26 #note-content {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.editor-formatbar {
  max-width: 100%;
}

.info-box h1 {
  margin: 0 0 7px;
  color: var(--accent2);
  font-size: clamp(16px, 2vw, 19px);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -.02em;
}

.feature-card .icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 11px;
  color: var(--accent2);
  background: rgba(255, 149, 0, .1);
}

.feature-card .icon svg {
  width: 19px;
  height: 19px;
}

.tfa-local-note {
  margin-top: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 650;
}

.tfa-box h3,
.overlay-card h3 {
  display: flex;
  align-items: center;
  gap: 7px;
}

.overlay-card h3 {
  justify-content: center;
}

.tfa-box h3 .theme-icon,
.overlay-card h3 .theme-icon {
  flex: none;
  color: var(--accent2);
}

.tfa-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tfa-actions .tfa-gen {
  margin-top: 0;
}

.tfa-clear {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--card-border);
  border-radius: 13px;
  background: var(--glass2);
  color: var(--text3);
  font-size: 12px;
  font-weight: 700;
  transition: color .22s ease, border-color .22s ease, background-color .22s ease;
}

.tfa-clear:hover,
.tfa-clear:focus-visible {
  color: var(--red);
  border-color: rgba(255, 69, 58, .38);
  background: rgba(255, 69, 58, .07);
}

.share-mode-card {
  max-width: 520px;
  padding: 24px;
  text-align: left;
}

.share-mode-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.share-mode-heading h3,
.share-mode-heading p {
  text-align: left;
}

.share-mode-heading p {
  margin: 5px 0 0;
}

.share-mode-close {
  display: grid;
  width: 36px;
  height: 36px;
  flex: none;
  place-items: center;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--glass2);
  color: var(--text3);
}

.share-mode-close svg {
  width: 17px;
  height: 17px;
}

.share-mode-close:hover,
.share-mode-close:focus-visible {
  color: var(--text);
  border-color: rgba(255, 149, 0, .38);
}

.share-mode-list {
  display: grid;
  gap: 9px;
}

.share-mode-option {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: var(--glass2);
  color: var(--text);
  text-align: left;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}

.share-mode-option:hover,
.share-mode-option:focus-visible {
  border-color: rgba(255, 149, 0, .42);
  background: rgba(255, 149, 0, .07);
  transform: translateY(-1px);
}

.share-mode-option.is-current {
  border-color: rgba(45, 185, 87, .45);
  background: rgba(45, 185, 87, .075);
}

.share-mode-option.is-selected {
  border-color: rgba(255, 149, 0, .52);
  background: rgba(255, 149, 0, .09);
}

.share-mode-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 149, 0, .1);
  color: var(--accent2);
}

.share-mode-icon svg {
  width: 21px;
  height: 21px;
}

.share-mode-copy {
  min-width: 0;
}

.share-mode-copy strong,
.share-mode-copy small {
  display: block;
}

.share-mode-copy strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .025em;
}

.share-mode-copy small {
  margin-top: 4px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.share-mode-check {
  width: 17px;
  height: 17px;
  border: 1.5px solid var(--text4);
  border-radius: 50%;
}

.share-mode-option.is-current .share-mode-check,
.share-mode-option.is-selected .share-mode-check {
  border: 5px solid var(--accent);
}

.share-mode-option.is-current .share-mode-check {
  border-color: var(--green);
}

.share-mode-option.is-current.is-selected .share-mode-check {
  border-color: var(--accent);
}

.share-mode-password {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--card-border);
}

.share-mode-password label {
  display: block;
  margin: 0 0 7px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 750;
}

.share-mode-password input {
  margin-bottom: 9px;
  text-align: left;
}

.share-mode-note {
  margin: 0 0 4px !important;
  color: var(--text3);
  font-size: 11px !important;
  text-align: left !important;
}

#share-mode-error {
  margin-top: 10px;
  margin-bottom: 6px;
}

.editor-format-lock-btn.mode-private {
  color: var(--red);
  border-color: rgba(255, 69, 58, .34);
  background: rgba(255, 69, 58, .075);
}

.editor-format-lock-btn.mode-read-only {
  color: var(--blue);
  border-color: rgba(10, 132, 255, .32);
  background: rgba(10, 132, 255, .07);
}

.editor-format-lock-btn.mode-public {
  color: var(--green);
  border-color: rgba(45, 185, 87, .32);
  background: rgba(45, 185, 87, .07);
}

:where(a, button, input, textarea, [contenteditable="true"]):focus-visible {
  outline: 3px solid rgba(10, 132, 255, .38);
  outline-offset: 2px;
}

/* Public information pages */
.public-page {
  background-attachment: fixed;
}

.public-main {
  width: min(100% - 28px, 920px);
  margin: 28px auto 36px;
}

.public-hero,
.public-section,
.public-contact-panel {
  border: 1px solid var(--glass-border);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.public-hero {
  padding: clamp(24px, 5vw, 46px);
  border-radius: 22px;
}

.public-hero h1 {
  max-width: 21ch;
  color: var(--text);
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.public-hero p {
  max-width: 68ch;
  margin-top: 16px;
  color: var(--text3);
  font-size: 15px;
  line-height: 1.75;
}

.public-section {
  margin-top: 16px;
  padding: clamp(22px, 4vw, 34px);
  border-radius: 18px;
}

.public-section h2 {
  margin: 28px 0 9px;
  color: var(--text);
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.public-section h2:first-child {
  margin-top: 0;
}

.public-section h3 {
  margin: 22px 0 7px;
  color: var(--text2);
  font-size: 15px;
}

.public-section p,
.public-section li {
  color: var(--text3);
  font-size: 14px;
  line-height: 1.78;
}

.public-section p + p {
  margin-top: 10px;
}

.public-section ul,
.public-section ol {
  margin: 10px 0 0 20px;
}

.public-section a,
.public-contact-panel a {
  color: var(--accent2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.public-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.public-fact {
  padding: 15px;
  border-top: 1px solid var(--card-border);
}

.public-fact strong,
.public-fact span {
  display: block;
}

.public-fact strong {
  color: var(--text);
  font-size: 13px;
}

.public-fact span {
  margin-top: 4px;
  color: var(--text3);
  font-size: 12px;
  line-height: 1.5;
}

.public-contact-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 22px 26px;
  border-radius: 18px;
}

.public-contact-panel p {
  color: var(--text3);
}

.public-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text3);
  font-size: 12px;
  font-weight: 700;
}

.public-back svg {
  width: 16px;
  height: 16px;
}

.public-updated {
  margin-top: 16px;
  color: var(--text4);
  font-size: 11px;
}

@media (max-width: 640px) {
  .header {
    padding-inline: 12px;
  }

  .logo-text {
    font-size: 16px;
  }

  .editor-formatbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .editor-formatbar::-webkit-scrollbar {
    display: none;
  }

  #note-content,
  html.ios26 #note-content {
    width: 100%;
    min-height: 50vh;
    padding: 18px 16px;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.72;
  }

  .toolbar-inner {
    align-items: stretch;
  }

  .tool-left {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  .tool-btn.link-btn {
    max-width: none;
    min-width: 0;
  }

  .tool-right {
    justify-content: flex-end;
  }

  .share-mode-card {
    max-height: min(88vh, 720px);
    overflow-y: auto;
    padding: 20px 16px;
  }

  .share-mode-option {
    grid-template-columns: 38px minmax(0, 1fr) 18px;
    gap: 10px;
    padding: 11px;
  }

  .share-mode-icon {
    width: 38px;
    height: 38px;
  }

  .tfa-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tfa-actions button {
    justify-content: center;
    width: 100%;
  }

  .public-main {
    width: min(100% - 20px, 920px);
    margin-top: 18px;
  }

  .public-hero,
  .public-section {
    border-radius: 18px;
  }

  .public-facts {
    grid-template-columns: 1fr;
  }

  .public-contact-panel {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.ios26 *,
  html.ios26 *::before,
  html.ios26 *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
